Skip to content

Text

Type

The Text type is used to represent character string values using UTF-8 encoding.

A Text variable can be initialized or mutated by assigning it a character string literal between double quotes or an expression of the Text type.

var reason = "amount can not be negative";
var emptyString = "";
var extendedReason = reason + ": " + (-5).toText();

Methods

plus

<function> Concatenates two texts.

Receiver

Text

Arguments

other - Text - text to concatenate to this

Returns

Text - the concatenation of this and other

lessThan

<function> Compares the two strings character by character until a character that is different is encountered. When such a character is encountered, this methods returns true if the character in this comes before others corresponding character in the alphabet. Otherwise, or if no such character is encountered, it returns false.

Receiver

Text

Arguments

other - Text - text to compare this with

Returns

Boolean - true if this is less than other, false otherwise

greaterThan

<function> Compares the two strings character by character until a character that is different is encountered. When such a character is encountered, this methods returns true if the character in this comes after others corresponding character in the alphabet. Otherwise, or if no such character is encountered, it returns false.

Receiver

Text

Arguments

other - Text - text to compare this with

Returns

Boolean - true if this is greater than other, false otherwise

lessThanOrEqual

<function> Like Text.lessThan, but also returns true if the texts are equal.

Receiver

Text

Arguments

other - Text - text to compare this with

Returns

Boolean - true if this is less than or equal to other, false otherwise

greaterThanOrEqual

<function> Like Text.greaterThan, but also returns true if the texts are equal.

Receiver

Text

Arguments

other - Text - text to compare this with

Returns

Boolean - true if this is greater than or equal to other, false otherwise

length

<function> Returns the character count of the contained text.

Receiver

Text

Returns

Number - number of characters

Inherited methods

toText

<function> Obtain the Text representation of this.

Receiver

T

Type Arguments

T

Returns

Text - the Text representation of this

Usage

Returns the text itself.