class String

String. More...

Definition#include <strings.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

This class implements the String datatype.

 String ()

Constructor for an empty string.

 String (const String& string)

Constructor for a copy of a string.

Parameters:
stringString to be copied.

 String (const char* string)

Constructor for a copy of a string.

Parameters:
stringString to be copied.

 String (const char* string, const cardinal length)

Constructor for a copy of a string with a given length to be copied.

Parameters:
stringString to be copied.
lengthNumber of bytes to be copied.

 String (const cardinal value)

Constructor for a string from a number.

Parameters:
valueNumber.

String ()

Destructor.

inline const char*  getData ()

[const]

Get string data.

Returns: String data.

inline cardinal  length ()

[const]

Get string length.

Returns: Length in bytes.

inline bool  isNull ()

[const]

Check, if string is NULL.

Returns: true, if string is NULL; false otherwise.

inline integer  index (const char c)

[const]

Find first position of a character in string.

Parameters:
cCharacter.

Returns: Position of -1, if character is not in string.

inline integer  rindex (const char c)

[const]

Find last position of a character in string.

Parameters:
cCharacter.

Returns: Position of -1, if character is not in string.

inline integer  find (const String& string)

[const]

Find first position of a string in a string

Parameters:
stringString to find in string.

Returns: Position of -1, if string is not in string.

String  toUpper ()

[const]

Get uppercase string from string.

Returns: Uppercase string.

String  toLower ()

[const]

Get lowercase string from string.

Returns: Lowercase string.

String  left (const cardinal maxChars)

[const]

Get left part of string.

Parameters:
maxCharsMaximum number of characters to be copied.

Returns: String.

String  mid (const cardinal start, const cardinal maxChars)

[const]

Get middle part of string.

Parameters:
startStart position in String.
maxCharsMaximum number of characters to be copied.

Returns: String.

inline String  mid (const cardinal start)

[const]

Get part from start to end of string.

Parameters:
startStart position in String.

Returns: String.

String  right (const cardinal maxChars)

[const]

Get right part of string.

Parameters:
maxCharsMaximum number of characters to be copied.

Returns: String.

String  stripWhiteSpace ()

[const]

Get string with spaces from beginning and end of the string removed.

Returns: New string.

bool  scanSetting (String& s1, String& s2)

[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:
nameReference to store the name.
valueReference to store the value.

Returns: true, if scan was successful; false otherwise.

String&  operator= (const String& string)

Implementation of = operator.

String&  operator= (const char* string)

Implementation of = operator.

String&  operator= (const cardinal value)

Implementation of = operator.

inline int  operator== (const String& string)

[const]

Implementation of == operator.

inline int  operator!= (const String& string)

[const]

Implementation of != operator.

inline int  operator< (const String& string)

[const]

Implementation of < operator.

inline int  operator<= (const String& string)

[const]

Implementation of <= operator.

inline int  operator> (const String& string)

[const]

Implementation of > operator.

inline int  operator>= (const String& string)

[const]

Implementation of >= operator.

inline char  operator[] (const int index)

[const]

Implementation of [] operator.

inline cardinal  stringLength (const char* string)

[static]

Compute length of a string.

Parameters:
stringString.

Returns: Length.

inline integer  stringCompare (const char* str1, const char* str2)

[static]

Compare two strings.

Parameters:
str1First string.
str2Second string.

Returns: str1 < str1 => -1; str1 == str2 => 0; str1 > str2 => 1.

inline char*  stringDuplicate (const char* string)

[static]

Duplicate a string. The new string can be deallocated with the delete operator.

Parameters:
stringString to be duplicated.

Returns: New string.