C++ Builder: String objects
String is used for declaring objects of the type "String" (note the uppercase S!).
S is an object, it's not a basic variable such as an int, float or char!
Functions for String objects: String methods
For the examples below, we assume the following declarations were done:
String S = "abcDEF";Delete(index, count) removes count characters from the String object, starting at position index. Example:
Insert(str, index) inserts the string str into the String object, beginning at the position index, where 1 is the first position. Example:
Length() returns the number of characters of a String object. Example:
IsEmpty() returns true if a String object is empty. Example:
LowerCase() returns a new String that contains all characters converted to lowercase. Example:
Pos(substr) returns the position at which a substring begins, where 1 is the index of the first character, and so on. If the substring is not contained in the original string, Pos() returns 0. Example:
SubString(index, count) returns a new String, that contains count characters beginning at index. Example:
Trim() returns a new String, removing leading and trailing spaces and control characters. Example:
TrimLeft() returns a new String, removing leading spaces and control characters.
TrimRight() returns a new String, removing trailing spaces and control characters.
UpperCase() returns a new String that contains all characters converted to uppercase. Example: