|
|
This class implements the String datatype.
String ()
| String |
Constructor for an empty string.
String (const String& string)
| String |
Constructor for a copy of a string.
Parameters:
string | String to be copied. |
String (const char* string)
| String |
Constructor for a copy of a string.
Parameters:
string | String to be copied. |
String (const char* string, const cardinal length)
| String |
Constructor for a copy of a string with a given length to be copied.
Parameters:
string | String to be copied. |
length | Number of bytes to be copied. |
String (const cardinal value)
| String |
Constructor for a string from a number.
Parameters:
value | Number. |
~String ()
| ~String |
Destructor.
inline const char* getData ()
| getData |
[const]
Get string data.
Returns: String data.
inline cardinal length ()
| length |
[const]
Get string length.
Returns: Length in bytes.
inline bool isNull ()
| isNull |
[const]
Check, if string is NULL.
Returns: true, if string is NULL; false otherwise.
inline integer index (const char c)
| index |
[const]
Find first position of a character in string.
Parameters:
c | Character. |
Returns: Position of -1, if character is not in string.
inline integer rindex (const char c)
| rindex |
[const]
Find last position of a character in string.
Parameters:
c | Character. |
Returns: Position of -1, if character is not in string.
inline integer find (const String& string)
| find |
[const]
Find first position of a string in a string
Parameters:
string | String to find in string. |
Returns: Position of -1, if string is not in string.
String toUpper ()
| toUpper |
[const]
Get uppercase string from string.
Returns: Uppercase string.
String toLower ()
| toLower |
[const]
Get lowercase string from string.
Returns: Lowercase string.
String left (const cardinal maxChars)
| left |
[const]
Get left part of string.
Parameters:
maxChars | Maximum number of characters to be copied. |
Returns: String.
String mid (const cardinal start, const cardinal maxChars)
| mid |
[const]
Get middle part of string.
Parameters:
start | Start position in String. |
maxChars | Maximum number of characters to be copied. |
Returns: String.
inline String mid (const cardinal start)
| mid |
[const]
Get part from start to end of string.
Parameters:
start | Start position in String. |
Returns: String.
String right (const cardinal maxChars)
| right |
[const]
Get right part of string.
Parameters:
maxChars | Maximum number of characters to be copied. |
Returns: String.
String stripWhiteSpace ()
| stripWhiteSpace |
[const]
Get string with spaces from beginning and end of the string removed.
Returns: New string.
bool scanSetting (String& s1, String& s2)
| scanSetting |
[const]
Scan setting string, e.g. " FileName = Test.file ". Spaces are removed, the first string (name) is converted to uppercase. The second string (value) may contain "-chars for values with spaces. The "-chars will be removed from the result.
Parameters:
name | Reference to store the name. |
value | Reference to store the value. |
Returns: true, if scan was successful; false otherwise.
String& operator= (const String& string)
| operator= |
Implementation of = operator.
String& operator= (const char* string)
| operator= |
Implementation of = operator.
String& operator= (const cardinal value)
| operator= |
Implementation of = operator.
inline int operator== (const String& string)
| operator== |
[const]
Implementation of == operator.
inline int operator!= (const String& string)
| operator!= |
[const]
Implementation of != operator.
inline int operator< (const String& string)
| operator< |
[const]
Implementation of < operator.
inline int operator<= (const String& string)
| operator<= |
[const]
Implementation of <= operator.
inline int operator> (const String& string)
| operator> |
[const]
Implementation of > operator.
inline int operator>= (const String& string)
| operator>= |
[const]
Implementation of >= operator.
inline char operator[] (const int index)
| operator[] |
[const]
Implementation of [] operator.
inline cardinal stringLength (const char* string)
| stringLength |
[static]
Compute length of a string.
Parameters:
string | String. |
Returns: Length.
inline integer stringCompare (const char* str1, const char* str2)
| stringCompare |
[static]
Compare two strings.
Parameters:
str1 | First string. |
str2 | Second string. |
Returns: str1 < str1 => -1; str1 == str2 => 0; str1 > str2 => 1.
inline char* stringDuplicate (const char* string)
| stringDuplicate |
[static]
Duplicate a string. The new string can be deallocated with the delete operator.
Parameters:
string | String to be duplicated. |
Returns: New string.