Strings have many methods attached to them for manipulating text.
struct String
{
static vararg string Format(string format, ...);
vararg void AppendFormat(string format, ...);
string CharAt(int pos) const;
int CharCodeAt(int pos) const;
string Filter();
int IndexOf(string substr, int startIndex = 0) const;
string Left(int len) const;
uint Length() const;
string Mid(int pos = 0, int len = int.Max) const;
void Remove(int index, int amount);
void Replace(string pattern, string replacement);
int RightIndexOf(string substr, int endIndex = int.Max) const;
void Split(out array<string> tokens, string delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
double ToDouble() const;
int ToInt(int base = 0) const;
void ToLower();
void ToUpper();
void Truncate(int newlen);
deprecated("3.5.1") int LastIndexOf(string substr, int endIndex = int.Max) const;
}
Creates a string using a format string and any amount of arguments.
Works like Format
, but appends the result to the string.
Returns the character at pos
as a new string.
Returns the character at pos
as an integer.
Replaces escape sequences in a string with escaped characters as a new string.
Returns the first index of substr
starting from the left at start
.
Returns the first len
characters as a new string.
Returns the number of characters in this string.
Returns len
characters starting at pos
as a new string.
Removes amount
characters starting at index
in place.
Replaces all instances of pattern
with replacement
in place.
Returns the first index of substr
starting from the right at end
.
Splits the string by each delimiter
into tokens
. keepEmpty
may be either
TOK_SKIPEMPTY
(the default) or TOK_KEEPEMPTY
, which will keep or discard
empty strings found while splitting.
Interprets the string as a double precision floating point number.
Interprets the string as a base base
integer, guessing the base if it is 0
.
Converts all characters in the string to lowercase in place.
Converts all characters in the string to uppercase in place.
Truncates the string to len
characters in place.
Broken. Use RightIndexOf
instead.