#include <MString.h>
Public Methods | |
String () | |
Construct an empty string. | |
String (const char *text) | |
Construct a string from text. | |
String (const char *text,int len) | |
Construct a string from the first len characters of text. | |
String (int size,int expand) | |
Construct an empty string with a buffer of given size. More... | |
String (const String &x,const String &y) | |
Construct a concatenation of the two strings. | |
String (const String &x, char ch) | |
Construct a concatenation of the string and a character. | |
String (const String &x) | |
Copy constructor (very fast - no text copying required). | |
String (int i) | |
Construct a string as base 10 representation of an int. | |
String (size_t i) | |
Construct a string as base 10 representation of an int. | |
String (bool b) | |
Construct a string from a bool (true or false). | |
String (long l) | |
Construct a string as base 10 representation of a long. | |
String (double d) | |
Construct a string as base 10 representation of double. | |
String (const LString &x) | |
Construct a String from an LString. | |
String& | operator= (const String &x) |
Assignment and concatenate and assign operators. | |
String& | operator= (const char *x) |
String& | operator+= (const String &x) |
String& | operator+= (const char *x) |
String& | operator+= (char x) |
String& | operator+= (const LString &x) |
char& | operator[] (int i) |
Index into string. More... | |
void | append (const String &x) |
append a String or char *. More... | |
void | append (const char *x) |
void | push (char x) |
Push a character onto a string. More... | |
String | operator+ (const String &x) const |
Add a String or a single char. | |
String | operator+ (const char *x) const |
String | operator+ (const LString &x) const |
String | operator+ (char x) const |
void | set_value (const char *text,int len) |
set the value of a string to the left most len characters of a char *. More... | |
~String () | |
int | compare (const String &x) const |
compare a string. More... | |
bool | operator== (const String &x) const |
The usual comparison operators. | |
bool | operator!= (const String &x) const |
bool | operator< (const String &x) const |
bool | operator<= (const String &x) const |
bool | operator> (const String &x) const |
bool | operator>= (const String &x) const |
operator const char * () const | |
Access the string as a const char *. More... | |
const char* | c_str () const |
bool | truncate_to_last (char marker) |
Truncate the string the the last instance of the character the matching character is removed. More... | |
bool | trim_to_first (char marker) |
Trim the prefix finishing with the first instance of the characeter The character is trimmed. | |
bool | truncate_at_pos (int pos) |
Truncate to a given position The new length will be equal to the parameter value. | |
bool | is_empty () const |
int | size () const |
int | length () const |
String | Left (int len) const |
Basic like string functions Left(len) - get String of left "len" chars Right(len) - get String of right "len" characters Mid(left_pos,len) - extract middle part of string Repeat(int times) - return this string repeated times times NOTE: for Left and Right, the length can be negative, in which case, the length of the string is added to the parameter - in other words, it is the number of characters to chop off. | |
String | Right (int len) const |
String | Mid (int left_pos,int len) const |
String | substr (int left_pos,int len) const |
String | Repeat (int times) |
bool | ends_in (const String &s) const |
Does the string end in or start with the comparison string? | |
bool | starts_with (const String &s) const |
int | find (const String &x) const |
Find a substring. More... | |
void | make_empty () |
Clear a string. |
|
Construct an empty string.
|
Construct a string from text.
|
Construct a string from the first len characters of text.
|
Construct an empty string with a buffer of given size.
- | size in bytes (rounded up to modulo 8) |
- | ignored. Must be present or what you will get is a string containing size as text |
|
Construct a concatenation of the two strings.
|
Construct a concatenation of the string and a character.
|
Copy constructor (very fast - no text copying required).
|
Construct a string as base 10 representation of an int.
|
Construct a string as base 10 representation of an int.
|
Construct a string from a bool (true or false).
|
Construct a string as base 10 representation of a long.
|
Construct a string as base 10 representation of double.
|
Construct a String from an LString.
|
|
Basic like string functions Left(len) - get String of left "len" chars Right(len) - get String of right "len" characters Mid(left_pos,len) - extract middle part of string Repeat(int times) - return this string repeated times times NOTE: for Left and Right, the length can be negative, in which case, the length of the string is added to the parameter - in other words, it is the number of characters to chop off.
|
|
|
|
|
append a String or char *.
Equivalent to +=
|
|
compare a string.
- | string to compare |
|
Does the string end in or start with the comparison string?
|
Find a substring.
Returns index of first character of substring, or -1 if not found
|
|
|
Clear a string.
|
Access the string as a const char *.
Two forms, as a cast and as a function
|
|
|
|
|
Add a String or a single char.
|
|
|
|
|
|
|
|
Assignment and concatenate and assign operators.
|
The usual comparison operators.
|
|
|
|
Push a character onto a string.
Present for hystorical reasons. Use += operator by preference
|
set the value of a string to the left most len characters of a char *.
- | text to set |
- | no of characters to take |
|
|
|
|
Trim the prefix finishing with the first instance of the characeter The character is trimmed.
|
Truncate to a given position The new length will be equal to the parameter value.
|
Truncate the string the the last instance of the character the matching character is removed.
Hence, fullpathname.truncate_to_last('/') will give you the directory name.