Reference
Text (str)
Building and reading text.
str.contains(s, sub)
True if s contains sub.
Returns: true or false
| Parameter | Type |
|---|---|
s | string |
sub | string |
str.endswith(s, suffix)
True if s ends with suffix.
Returns: true or false
| Parameter | Type |
|---|---|
s | string |
suffix | string |
str.format(formatString, ...args)
Fills {0}, {1}, ... placeholders.
Returns: text
| Parameter | Type |
|---|---|
formatString | string |
args | any |
str.length(s)
Number of characters.
Returns: a whole number
| Parameter | Type |
|---|---|
s | string |
str.lower(s)
Lower case.
Returns: text
| Parameter | Type |
|---|---|
s | string |
str.pos(s, sub)
Position of sub in s (na if absent).
Returns: a whole number
| Parameter | Type |
|---|---|
s | string |
sub | string |
str.repeat(s, repeat, separator="")
s repeated n times.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
s | string | |
repeat | int | |
separator | string | Default "" |
str.replace(s, target, replacement, occurrence=0)
Replaces one occurrence of target.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
s | string | |
target | string | |
replacement | string | |
occurrence | int | Default 0 |
str.replace_all(s, target, replacement)
Replaces every occurrence of target.
Returns: text
| Parameter | Type |
|---|---|
s | string |
target | string |
replacement | string |
str.split(s, separator)
Splits text into an array.
Returns: an array of string
| Parameter | Type |
|---|---|
s | string |
separator | string |
str.startswith(s, prefix)
True if s starts with prefix.
Returns: true or false
| Parameter | Type |
|---|---|
s | string |
prefix | string |
str.substring(s, begin, end=na)
Part of s from begin up to (not including) end.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
s | string | |
begin | int | |
end | int | Default na |
str.tonumber(s)
Parses text as a number (na if it is not one).
Returns: a number
| Parameter | Type |
|---|---|
s | string |
str.tostring(value, format="")
Formats a value as text ("#.##", "0.00", "percent", "price", "volume").
Returns: text
| Parameter | Type | Notes |
|---|---|---|
value | any | |
format | string | Default "" |
str.trim(s)
Removes spaces at both ends.
Returns: text
| Parameter | Type |
|---|---|
s | string |
str.upper(s)
Upper case.
Returns: text
| Parameter | Type |
|---|---|
s | string |
Education only. Not financial advice. Examples are teaching samples, not trading results.
