The C++ String Class

The String class is provided for handling character strings.

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 )
Gets 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 )
Compares the current Value (this) with the argument str and returns 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 )
Concatenates the two strings; returns the concatenated resulting String.
String* create( int len )
Creates an empty String of the specified length.
String* create( char const * str )
Creates a String with the specified content.
String* create( char const * str, int len )
Creates a String with the specified content and length.
char * cstr( void )
Converts the String to a null-terminated character string.
String* format( char const * fmt, ... )
Creates a String with the specified content and placeholders substituted with the specified values.
int indexOf( String * s )
Finds the position of the specified substring in this String.
bool startsWith( String * prefix )
Checks if this String starts with the specified prefix.
String* substr( int pos, int len )
Extracts a substring of the specified length from the starting position pos within this String.
String* toLowerCase( void )
Converts this String to lower case.
String* toUpperCase( void )
Converts this String to upper case.