Usage
String methods are called directly on string values using JavaScript-style method syntax. They behave exactly like standard JavaScript string methods.
var symbol = "BTC-USDT"
var parts = symbol.split("-") // ["BTC", "USDT"]
var text = "hello world"
var upper = text.toUpperCase() // "HELLO WORLD"
var str = "btc-usdt";
var str2 = " too high";
print(str.concat(str2));
// outputs "btc-usdt too high"Available Methods
| Method | Category | Signature | Description |
|---|---|---|---|
split | Transformation | str.split(separator) | Splits a string into an array of substrings using a separator |
concat | Transformation | str.concat(...strings) | Concatenates multiple strings together into a single string |
substring | Transformation | str.substring(start, end?) | Extracts a portion of the string between two indices |
toUpperCase | Transformation | str.toUpperCase() | Converts all characters in the string to uppercase |
toLowerCase | Transformation | str.toLowerCase() | Converts all characters in the string to lowercase |
trim | Transformation | str.trim() | Removes whitespace from both ends of the string |
replace | Transformation | str.replace(search, replaceWith) | Replaces the first occurrence of a search string with a replacement string |
indexOf | Inspection | str.indexOf(searchValue) | Returns the index of the first occurrence of a substring (-1 if not found) |
startsWith | Inspection | str.startsWith(prefix) | Checks if the string starts with the specified prefix |
endsWith | Inspection | str.endsWith(suffix) | Checks if the string ends with the specified suffix |
length | Inspection | str.length() | Returns the number of characters in the string |