Numbers & Text > Text


Conversion

Convert to Text

convert-text-block

Converts the given value to text.

("" + [VALUE])

Operations

Text Length

length-block

Returns the number of characters in the given text.

[TEXT].length

Combine Text

combine-block

Combines the two given pieces of text into one and returns that result.

[TEXT] + [TEXT]

Trim Text

trim-block

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])

Comparison

Equals (Text)

equals-block

Returns true if both pieces of text are exactly the same.

([TEXT] == [TEXT])

Is Text Empty?

empty-block

Returns true if the length of the given text is 0.

([TEXT] == "")

Does Text come before/after?

before-block after-block

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);

Find / Replace

Find Character

char-block

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([NUMBER])

Get Text Position

textpos-block

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])

Replace Text in Text

replace-block

Replaces one phrase with another within the given text.

Example:
replace-example
Returns cheeseburger

StringUtil.replace([TEXT], [TEXT], [TEXT])

Substring (Part of Text)

substring-block

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([NUMBER], [NUMBER])

Case

Get Text in Upper/Lower Case

uppercase-block lowercase-block

Returns the given text in all uppercase (or lowercase).

[TEXT].toUpperCase()
[TEXT].toLowerCase()

Split

Split into Words

split-block

Splits the given text up into a list, using space as the separator (delimiter).

[TEXT].split(" ")

Split using Separator

split-block2

Splits the given text up into a list, using the given separator (delimiter) text.

[TEXT].split([TEXT])

Fonts

Get Width of Text using Font

text-width-block

Returns the width of the given text using the given font. Useful for calculating positions for drawing text.

[FONT].font.getTextWidth([TEXT])

Get Height of Font

text-height-block

Returns the height of the given font. Useful for calculating positions for drawing text.

[FONT].getHeight()