String
An immutable sequence of Unicode characters.
Static Methods
format_time
String.format_time(
time: int,
format: String,
timezone: String = symbol_info.timezone
): StringFormats a timestamp (in milliseconds since epoch) into a String based on the provided format and timezone.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
time | int | The timestamp in milliseconds since epoch to format. | |
format | String | The format String for the conversion. | |
timezone | String | symbol_info.timezone | The timezone to use for formatting. |
Returns: String
from
Converts a value to its String representation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | int | The integer value to convert. | |
format | String | The format String for the conversion. |
Returns: String
Methods
contains
String.contains(self: String, str: String): boolChecks if the String contains the specified substring.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
str | String | The substring to search for. |
Returns: bool
ends_with
String.ends_with(self: String, str: String): boolChecks if the String ends with the specified suffix.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
str | String | The suffix to search for. |
Returns: bool
format
String.format(self: String, values: any): StringFormats the String as a template, substituting {} placeholders with the provided values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
values | any | Variable number of values to substitute into the template. |
Returns: String
index_of
String.index_of(self: String, str: String): intReturns the zero-based index of the first occurrence of a substring, or na if not found.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
str | String | The substring to search for. |
Returns: int
length
String.length(self: String): intReturns the length of the String.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: int
lower
String.lower(self: String): StringConverts all characters in the String to lowercase.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: String
match
String.match(self: String, regex: String): StringReturns the matched substring if the String matches a regex pattern, or an empty String otherwise.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
regex | String | The regular expression pattern to match. |
Returns: String
pad_end
String.pad_end(self: String, len: int, fill: String = " "): StringRight-pads the String with fill until it reaches at least len characters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
len | int | The minimum target length in characters. | |
fill | String | " " | The padding String. Defaults to " ". |
Returns: String
pad_start
String.pad_start(self: String, len: int, fill: String = " "): StringLeft-pads the String with fill until it reaches at least len characters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
len | int | The minimum target length in characters. | |
fill | String | " " | The padding String. Defaults to " ". |
Returns: String
repeat
String.repeat(self: String, repeat: int): StringReturns a new String consisting of the String repeated a specified number of times.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
repeat | int | The number of times to repeat the String. |
Returns: String
replace
String.replace(
self: String,
target: String,
replacement: String,
occurrence: int = 0
): StringReplaces the N-th occurrence of a target substring with a replacement.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
target | String | The substring to be replaced. | |
replacement | String | The replacement substring. | |
occurrence | int | 0 | N-th occurrence to replace (0-indexed). Defaults to 0. |
Returns: String
replace_all
String.replace_all(self: String, target: String, replacement: String): StringReplaces all occurrences of a target substring with a replacement.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
target | String | The substring to be replaced. | |
replacement | String | The replacement substring. |
Returns: String
split
String.split(self: String, separator: String): Array<String>Splits the String into an array of substrings based on a separator.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
separator | String | The separator String to split on. |
starts_with
String.starts_with(self: String, str: String): boolChecks if the String starts with the specified prefix.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
str | String | The prefix to search for. |
Returns: bool
substring
String.substring(self: String, begin_pos: int, end_pos: int): StringReturns a substring from begin_pos to end_pos (exclusive).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String | ||
begin_pos | int | The starting position (inclusive). | |
end_pos | int | The ending position (exclusive). |
Returns: String
to_number
String.to_number(self: String): floatConverts the String to a floating-point number.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: float — The parsed float value, or na if the String cannot be parsed.
trim
String.trim(self: String): StringTrims leading and trailing whitespace from the String.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: String
trim_end
String.trim_end(self: String): StringTrims trailing whitespace from the String.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: String
trim_start
String.trim_start(self: String): StringTrims leading whitespace from the String.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: String
upper
String.upper(self: String): StringConverts all characters in the String to uppercase.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
self | String |
Returns: String

