#include <lkstring.h>
Inheritance diagram for look::LookString::
Public Types | |
enum | StripType { leading = 1, trailing, both } |
Which end to strip. | |
Public Methods | |
LookString (const char *theString) | |
Constructor like std::string. | |
LookString (const char *theString, stringBaseType::size_type theSize) | |
Constructor like std::string. | |
LookString (const LookString &theString) | |
Copy constructor. | |
LookString (const LookString &theString, stringBaseType::size_type theStart, stringBaseType::size_type theSize) | |
Copy constructor like std::string. | |
LookString (const stringBaseType &theString) | |
Copy constructor. | |
LookString (stringBaseType::size_type theSize, char theChar) | |
Constructor like std::string. More... | |
LookString () | |
Default Constructor. | |
~LookString (void) | |
Destructor. | |
LookString& | operator= (const LookString &theOther) |
Assignment. | |
LookString& | operator= (const char *theString) |
Assignment from const char*. | |
LookString& | operator= (stringBaseType theString) |
Assignment from std::string. | |
char& | operator[] (int position) |
Operator[] like std::string. | |
char | operator[] (int position) const |
Operator[] like std::string. | |
operator const char * (void) const | |
Cast to const char*. More... | |
LookTypeBase* | GetNewCopy (void) const |
Get a new copy. More... | |
long | GetTypeID (void) const |
Get Type ID. More... | |
void | Strip (StripType theStripType, char theChar) |
Strip character from ends. More... | |
void | Strip (StripType theStripType, const LookString &theChars) |
Strip characters from ends. More... | |
void | StripNotIn (StripType theStripType, const LookString &theChars) |
Strip characters from ends. More... | |
void | ToLower (void) |
Converts to lowercase using tolower. | |
void | ToUpper (void) |
Converts to uppercase using toupper. | |
int | ReplaceStrings (const LookString &theFromString, const LookString &theToString) |
Replace strings. More... |
This is essentially std::string but also a LookTypeBase and there are a couple of other methods that I wanted.
Remember std::string doesn't have a virtual destructor, so take care with pointers to std::string (don't use them?).
(otoh LookTypeBase is designed to be used as pointers).
|
Constructor like std::string. Creates a string of theSize theChars.
|
|
Get a new copy. Virtual copy constructor, aka clone.
Reimplemented from look::LookTypeBase. |
|
Get Type ID. Pseudo-rtti, or isA.
Reimplemented from look::LookTypeBase. |
|
Replace strings. Eg ReplaceStrings( "fred", "jim" ) on "fred lived with other fred" will give "jim lived with other jim" and return 2.
|
|
Strip characters from ends. Strips any of the characters in theChars from the ends of the string. Eg Strip( LookString::both, " _" ) on " _ fred _was_ here " will give "fred _was_ here".
|
|
Strip character from ends. Strips the character theChar from the ends of the string. Eg Strip( LookString::both, ' ' ) on " fred was here " will give "fred was here".
|
|
Strip characters from ends. Strips any of the characters NOT in theChars from the ends of the string. Eg StripNotIn( LookString::both, "123" ) on "fred lived at 22 High Street. He moved there on the 21st" will give "22 High Street. He moved there on the 21".
|
|
Cast to const char*. Yes, I know there are reasons why std::string doesn't have this cast but I find it more useful than not. |