Table of Contents



String Formatting Methods

String formatting methods create derived string values from an existing string.


repeat(count)

Repeats the string.

Argument Type Description
`count` number Number of repetitions. Values less than or equal to zero return an empty string.

Returns: string.

Example:

'ab'.repeat(3);       // 'ababab'

padleft(pad, length)

Pads the string on the left until it reaches the requested length.

Argument Type Description
`pad` any Padding text. Empty padding uses a space.
`length` number Target string length.

Returns: string.

Example:

'7'.padleft('0', 3);  // '007'

padright(pad, length)

Pads the string on the right until it reaches the requested length.

Argument Type Description
`pad` any Padding text. Empty padding uses a space.
`length` number Target string length.

Returns: string.

Example:

'7'.padright('0', 3); // '700'

table()

Formats semicolon-separated text as a table.

Item Description
Syntax `string.table()`
Arguments none
Returns string

Example:

text = 'A;B;C';
text.table();

table(header)

Formats semicolon-separated text as a table, optionally treating the first row as a header.

Argument Type Description
`header` any Converted to bool. True means the first row is treated as a header.

Returns: string.

Example:

text = 'Name;Value\nX;10';
text.table(true);

ord()

Returns the numeric code of the first character.

Item Description
Syntax `string.ord()`
Arguments none
Returns number

An empty string returns `0`.

Example:

'A'.ord();            // 65
''.ord();             // 0

Previous: String Parsing Methods

Next: String Regex Methods