C++ Builder: String objectsString is used for declaring objects of the type "String" (note the uppercase S!). String S;
Functions for String objects: String methodsFor 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: S.Delete(1, 2); // S becomes "cDEF" Insert(str, index) inserts the string str into the String object, beginning at the position index, where 1 is the first position. Example: S.Insert("ab", 1); // S becomes "ababcDEF" Length() returns the number of characters of a String object. Example: i = S.Length(); // returns 6 IsEmpty() returns true if a String object is empty. Example: empt = S.IsEmpty(); // returns false LowerCase() returns a new String that contains all characters converted to lowercase. Example: S2 = S.LowerCase(); // returns "abcdef" 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: i = S.Pos("abc"); // returns 1 SubString(index, count) returns a new String, that contains count characters beginning at index. Example: S2 = S.SubString(2, 3); // returns "bcD" Trim() returns a new String, removing leading and trailing spaces and control characters. Example: S = Edit1->Text; 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: S2 = S.UpperCase(); // returns "ABCDEF" |