Table of Contents



String Functions

These built-in functions create strings. Methods for parsing, trimming, searching, and converting strings are documented under Built-in methods.


str()

Returns an empty string.

Argument Type Description
none No arguments.

Returns: string.

Example:

text = str();         // ''

str(value)

Converts a value to string form.

Argument Type Description
`value` any Value to convert.

Returns: string.

Example:

str(123);             // '123'
str(none());          // string form of none

str(count, pattern)

Repeats a pattern string.

Argument Type Description
`count` number Number of repetitions. Negative values behave like zero.
`pattern` any Pattern converted to string and repeated.

Returns: string.

Example:

str(3, 'ab');         // 'ababab'
str(5, '-');          // '-----'

str_rand(length)

Creates a random string.

Argument Type Description
`length` number Requested string length.

Returns: string.

Example:

token = str_rand(16);

str_spaces(count)

Creates a string of spaces.

Argument Type Description
`count` number Number of spaces. Negative values behave like zero.

Returns: string.

Example:

indent = str_spaces(4);
text = indent + 'line';

str_uuid()

Creates a UUID string.

Argument Type Description
none No arguments.

Returns: string.

Example:

id = str_uuid();

Previous: Rounding and Centering

Next: Output, Formatting, and Errors