Reference
String
Constructor
| Input | A text surrounded by single or double quotes. |
|---|---|
| Output | A string containing the text. |
Signature
"Lorem ipsum dolor sit amet": StringExample
"Hello, world!"Indexing
| Input | A string and a number representing the index. |
|---|---|
| Output | The character at the specified index. |
Signature
String[Number]: StringExample
"hello"[0] // returns "h"At
| Input | A string and a number representing the index. |
|---|---|
| Output | The character at the specified index. |
Signature
str_at(a: String, b: Number): StringExample
str_at("hello", 1) // returns "e"First
| Input | A string. |
|---|---|
| Output | The first character of the string. |
Signature
str_first(a: String): StringExample
str_first("hello") // returns "h"Last
| Input | A string. |
|---|---|
| Output | The last character of the string. |
Signature
str_last(a: String): StringExample
str_last("hello") // returns "o"Substring
| Input | A string and two numbers representing the start and end indices. |
|---|---|
| Output | The substring from the start index to the end index. |
Signature
str_substring(a: String, b: Number, c: Number): StringExample
str_substring("hello", 1, 4) // returns "ell"Init
| Input | A string. |
|---|---|
| Output | A new string without its last character. |
Signature
str_init(a: String): StringExample
str_init("hello") // returns "hell"Rest
| Input | A string. |
|---|---|
| Output | A new string without its first character. |
Signature
str_rest(a: String): StringExample
str_rest("hello") // returns "ello"Take
| Input | A string and a number representing the number of characters. |
|---|---|
| Output | The first n characters of the string. |
Signature
str_take(a: String, b: Number): StringExample
str_take("hello", 3) // returns "hel"Drop
| Input | A string and a number representing the number of characters. |
|---|---|
| Output | A new string without the first n characters. |
Signature
str_drop(a: String, b: Number): StringExample
str_drop("hello", 2) // returns "llo"Concat
| Input | Two strings. |
|---|---|
| Output | The concatenation of the two strings. |
Signature
str_concat(a: String, b: String): StringExample
str_concat("hello", " world") // returns "hello world"Replace
| Input | A string, a regex pattern, and a replacement string. |
|---|---|
| Output | A new string with all matches of the regex pattern replaced by the replacement string. |
Signature
str_replace(a: String, b: String, c: String): StringExample
str_replace("hello world", "world", "there") // returns "hello there"Uppercase
| Input | A string. |
|---|---|
| Output | A new string converted to uppercase. |
Signature
str_uppercase(a: String): StringExample
str_uppercase("hello") // returns "HELLO"Lowercase
| Input | A string. |
|---|---|
| Output | A new string converted to lowercase. |
Signature
str_lowercase(a: String): StringExample
str_lowercase("HELLO") // returns "hello"Trim
| Input | A string. |
|---|---|
| Output | A new string with leading and trailing whitespace removed. |
Signature
str_trim(a: String): StringExample
str_trim(" hello ") // returns "hello"Trim Left
| Input | A string. |
|---|---|
| Output | A new string with leading whitespace removed. |
Signature
str_trimLeft(a: String): StringExample
str_trimLeft(" hello") // returns "hello"Trim Right
| Input | A string. |
|---|---|
| Output | A new string with trailing whitespace removed. |
Signature
str_trimRight(a: String): StringExample
str_trimRight("hello ") // returns "hello"Capitalize
| Input | A string. |
|---|---|
| Output | A new string with the first character capitalized. |
Signature
str_capitalize(a: String): StringExample
str_capitalize("hello") // returns "Hello"Repeat
| Input | A string and a number. |
|---|---|
| Output | The string repeated n times. |
Signature
str_repeat(a: String, b: Number): StringExample
str_repeat("ab", 3) // returns "ababab"Remove at
| Input | A string and a number representing the index. |
|---|---|
| Output | A new string with the character at the specified index removed. |
Signature
str_removeAt(a: String, b: Number): StringExample
str_removeAt("hello", 1) // returns "hllo"Reverse
| Input | A string. |
|---|---|
| Output | A new string with its characters in reverse order. |
Signature
str_reverse(a: String): StringExample
str_reverse("hello") // returns "olleh"Pad left
| Input | A string, a number representing the minimum length, and a string to pad with. |
|---|---|
| Output | A new string padded on the left with the specified padding. |
Signature
str_padLeft(a: String, b: Number, c: String): StringExample
str_padLeft("42", 5, "0") // returns "00042"Pad right
| Input | A string, a number representing the minimum length, and a string to pad with. |
|---|---|
| Output | A new string padded on the right with the specified padding. |
Signature
str_padRight(a: String, b: Number, c: String): StringExample
str_padRight("hi", 5, ".") // returns "hi..."Split
| Input | A string and a separator string. |
|---|---|
| Output | A list of the string's substrings separated by the separator. |
Signature
str_split(a: String, b: String): ListExample
str_split("a,b,c", ",") // returns ["a", "b", "c"]Lines
| Input | A string. |
|---|---|
| Output | A list of lines in the string. |
Signature
str_lines(a: String): ListExample
str_lines("a\nb\nc") // returns ["a", "b", "c"]Contains
| Input | Two strings. |
|---|---|
| Output | True if the first string contains the second string. False otherwise. |
Signature
str_contains(a: String, b: String): BooleanExample
str_contains("hello world", "world") // returns trueStarts with
| Input | Two strings. |
|---|---|
| Output | True if the first string starts with the second string. False otherwise. |
Signature
str_startsWith(a: String, b: String): BooleanExample
str_startsWith("hello", "hel") // returns trueEnds with
| Input | Two strings. |
|---|---|
| Output | True if the first string ends with the second string. False otherwise. |
Signature
str_endsWith(a: String, b: String): BooleanExample
str_endsWith("hello", "llo") // returns trueMatch
| Input | A string and a regex pattern. |
|---|---|
| Output | True if the string matches the regex pattern. False otherwise. |
Signature
str_match(a: String, b: String): BooleanExample
str_match("hello123", "[a-z]+[0-9]+") // returns trueIndex of
| Input | Two strings. |
|---|---|
| Output | The index of the first occurrence of the second string in the first string, or -1 if not found. |
Signature
str_indexOf(a: String, b: String): NumberExample
str_indexOf("hello", "l") // returns 2Last Index Of
| Input | A string and a substring. |
|---|---|
| Output | The index of the last occurrence of the substring, or -1 if not found. |
Signature
str_lastIndexOf(a: String, b: String): NumberExample
str_lastIndexOf("hello", "l") // returns 3Count
| Input | A string and a substring. |
|---|---|
| Output | The number of occurrences of the substring in the string. If the substring is empty, returns the length of the string plus one (the number of positions where an empty string can be found). |
Signature
str_count(a: String, b: String): NumberExample
str_count("banana", "a") // returns 3Length
| Input | A string. |
|---|---|
| Output | The length of the string. |
Signature
str_length(a: String): NumberExample
str_length("hello") // returns 5Is empty
| Input | A string. |
|---|---|
| Output | True if the string is empty. False otherwise. |
Signature
str_isEmpty(a: String): BooleanExample
str_isEmpty("") // returns trueIs not empty
| Input | A string. |
|---|---|
| Output | True if the string is not empty. False otherwise. |
Signature
str_isNotEmpty(a: String): BooleanExample
str_isNotEmpty("hello") // returns trueIs Blank
| Input | A string. |
|---|---|
| Output | True if the string is empty or contains only whitespace, false otherwise. |
Signature
str_isBlank(a: String): BooleanExample
str_isBlank(" ") // returns trueIs Uppercase
| Input | A string. |
|---|---|
| Output | True if the string is all uppercase, false otherwise. |
Signature
str_isUppercase(a: String): BooleanExample
str_isUppercase("HELLO") // returns trueIs Lowercase
| Input | A string. |
|---|---|
| Output | True if the string is all lowercase, false otherwise. |
Signature
str_isLowercase(a: String): BooleanExample
str_isLowercase("hello") // returns trueIs Alpha
| Input | A string. |
|---|---|
| Output | True if the string contains only letters, false otherwise. |
Signature
str_isAlpha(a: String): BooleanExample
str_isAlpha("hello") // returns trueIs Numeric
| Input | A string. |
|---|---|
| Output | True if the string contains only digits, false otherwise. |
Signature
str_isNumeric(a: String): BooleanExample
str_isNumeric("12345") // returns trueIs Alphanumeric
| Input | A string. |
|---|---|
| Output | True if the string contains only letters and digits, false otherwise. |
Signature
str_isAlphaNumeric(a: String): BooleanExample
str_isAlphaNumeric("hello123") // returns trueBytes
| Input | A string. |
|---|---|
| Output | A list of the string's bytes. |
Signature
str_bytes(a: String): ListExample
str_bytes("AB") // returns [65, 66]From Bytes
| Input | A list of bytes. |
|---|---|
| Output | A string created from the byte list. |
Signature
str_fromBytes(a: List): StringExample
str_fromBytes([72, 105]) // returns "Hi"Compare
| Input | Two strings. |
|---|---|
| Output | 1 if the first string is bigger than the second. -1 if it is the smaller. 0 if they are equal. |
Signature
str_compare(a: String, b: String): NumberExample
str_compare("apple", "banana") // returns -1