The C++ String Class

The String class is provided for handling character stings.

For an overview see page C++ Classes

Note that String inherits from List which implements methods common to Arrays and Strings.

The String methods are listed below.

char * body( void ) Get the string body; returns the char array forming the String body (Note that the char array might not be null-terminated)
int compare( char const * str ) Compare the current Value (this) with the argument str and return an integer value indicating the result of the comparison: a negative integer value if this is less than str, zero if they are equal, and a positive integer value if this is greater than str
String* concat( String * head, String * tail ) Concatenate the two strings; returns the concatenated resulting String
String* create( int len ) Create an empty String of the specified length
String* create( char const * str ) Create a String with the specified content
String* create( char const * str, int len ) Create a String with the specified content and length
char * cstr( void ) Convert the String to a null-terminated character string
String* format( char const * fmt, … ) Create a String with the specified content and placeholders substituted with the specified values
int indexOf( String * s ) Find the position of the specified substring in this String
bool startsWith( String * prefix ) Check if this String starts with the specified prefix
String* substr( int pos, int len ) Extract a substring of the specified length from the starting position pos within this String
String* toLowerCase( void ) Convert this String to lower case
String* toUpperCase( void ) Convert this String to upper case