String formatting methods create derived string values from an existing string.
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'
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'
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'
Formats semicolon-separated text as a table.
| Item | Description |
|---|---|
| Syntax | `string.table()` |
| Arguments | none |
| Returns | string |
Example:
text = 'A;B;C'; text.table();
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);
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