Amtiri Script

Strings

Download PDF

Strings

Format

format · format(format: string, [parameters: any...])

Builds a text from a pattern and its arguments, using Java format specifiers - %s for text, %d for a whole number, %.2f for two decimals. The decimal separator follows the locale set when the formula was compiled.

Parameters

Name Type Description
format string The pattern, with one specifier per argument.
parameters any (0 or more) A value to substitute into the pattern, in order.

Returns string: The formatted text.

Examples

format("%s at %.1f %%", TAG, LEVEL) → "P-101 at 42.5 %"
"%05d".format(COUNT) → "00003"
format("%tT", START) → "08:00:00"
"#%06X".format(rgb(1, 0, 0)) → "#FF0000"

Substring

substr · substr(string: string, from: int, to: int)

The part of a text between two positions, counting from 0 and excluding the character at to.

Parameters

Name Type Description
string string The text to cut.
from int The first position to keep, counting from 0.
to int The first position to drop.

Returns string: The extracted text.

Examples

substr(TAG, 2, 5) → "101"
TAG.substr(0, 1) → "P"

To lower case

to_lower · to_lower(string: string)

Converts a text to lower case.

Parameters

Name Type Description
string string The text to convert.

Returns string: The lower-case text.

Examples

to_lower(TAG) → "p-101"

To upper case

to_upper · to_upper(string: string)

Converts a text to upper case.

Parameters

Name Type Description
string string The text to convert.

Returns string: The upper-case text.

Examples

to_upper("pump") → "PUMP"

Trim

trim · trim(string: string)

Removes leading and trailing whitespace from a text.

Parameters

Name Type Description
string string The text to trim.

Returns string: The trimmed text.

Examples

trim("  P-101 ") → "P-101"

This page describes Amtiri Script 5.4.1 as shipped with Data Orchester engine 6.12.1 and Site 1.22.7.