Converts the given value to text.
("" + [VALUE])
Returns an empty text ("").
""
Returns a space (" ").
" "
Returns the number of characters in the given text.
[TEXT].length
Combines the two given pieces of text into one and returns that result.
[TEXT] + [TEXT]
Removes spaces from the beginning and the end of the given text and returns that result. (When given an attribute, the value of the attribute remains unchanged.)
StringTools.trim([TEXT])
Returns true
if both pieces of text are exactly the same.
([TEXT] == [TEXT])
Returns true
if the length of the given text is 0.
([TEXT] == "")
Returns true
if the first given text alphabetically comes before (or after) the second given text.
//A comes BEFORE B
strCompare([TEXT], [TEXT], -1);
//A comes AFTER B
strCompare([TEXT], [TEXT], 1);
Returns the character at the given position. Note that the first index in a text is 0, not 1. Throws a runtime error if the given position is out of bounds.
[TEXT].charAt([INT])
Returns the index at which the given phrase (or character) appears in the given text. Returns -1 if the phrase is not found.
Example: The word "dog" corresponds to these indices: d = 0, o = 1 and g = 2. If you selected the letters "og" from the word "dog" (enter "og" in the field on the left and "dog" in the field on the right), the result would be 1.
[TEXT].indexOf([TEXT])
Replaces one phrase with another within the given text.
Example:
Returnscheeseburger
StringTools.replace([TEXT], [TEXT], [TEXT])
Returns part of the given text, given the starting and ending indices. More specifically, this block returns the characters beginning with the start index and ending with one less than the ending index.
Example: The word "cats" corresponds to these indices: c = 0, a = 1, t = 2, s = 3. If you enter "cats" in the field on the left, and 1, 3 as your starting and ending index numbers, the block would return the letters "at", i.e. the letters that correspond to the index numbers 1 and 2 in the word "cats."
[TEXT].substring([INT], [INT])
Returns the given text in all uppercase (or lowercase).
[TEXT].toUpperCase()
[TEXT].toLowerCase()
Splits the given text up into a list, using space as the separator (delimiter).
[TEXT].split(" ")
Splits the given text up into a list, using the given separator (delimiter) text.
[TEXT].split([TEXT])
Returns the width of the given text using the given font. Useful for calculating positions for drawing text.
[FONT].font.getTextWidth([TEXT], [FONT].letterSpacing)/Engine.SCALE
Returns the height of the given font. Useful for calculating positions for drawing text.
[FONT].getHeight()/Engine.SCALE