String
Functions
Capitalizes each letter in the given string.
String.capitalize("the cake is a lie!") == "The Cake Is A Lie!"
Joins the given array of strings.
String.concat(["A","B","C"]) == "ABC"
Drops the number of characters from the string.
String.dropLeft(1, "abc") == "bc"
String.dropLeft(2, "abc") == "c"
Joins the given array of strings, alias for String.concat
.
String.fromArray(["A","B","C"]) == "ABC"
Indents the string with the given number of spaces.
String.indent(2, "Hello There!") == " Hello There!"
Indents the string with the given number of characters using the given options.
String.indentWithOptions(2, "-", false, "Hello There!") == "--Hello There!"
Returns if the given string is an anagram of the other string.
String.isAnagram("asd", "blah") == false
String.isAnagram("rail safety", "fairy tales") == true
Returns whether or not the string is blank (only contains whitespace).
String.isBlank("") == true
String.isBlank(" ") == true
String.isBlank("a") == false
Returns whether or not the string is empty ("").
String.isEmpty("") == true
String.isEmpty("a") == false
String.isEmpty(" ") == false
Returns whether or not the string is not blank.
String.isNotBlank("a") == true
String.isNotBlank(" ") == false
Returns whether or not the string is not empty.
String.isNotEmpty("a") == true
String.isNotEmpty(" ") == true
Joins the given array of string into a single string using the separator.
String.join(",", ["A","B","C"]) == "A,B,C"
Removes all occurrences of the given character from the start of the given string.
String.lchop("!", "!!!Hello") == "Hello"
Returns if the given pattern is included in the given string.
String.match("A", "ABC") == true
String.match("X", "ABC") == false
Parameterizes the string:
-
replaces non alphanumeric, dash and underscore characters with dash
-
converts title case to dash case (TitleCase -> title-case)
-
collapses multiple dashes into a single one
-
removes the leading and trailing dash(es)
-
converts to lowercase
String.parameterize("Ui.ActionSheet") == "ui-action-sheet" String.parameterize("HELLO THERE!!!") == "hello-there" String.parameterize("-!ASD!-") == "asd"
Removes all occurrences of the given character from the end of the given string.
String.rchop("!", "Hello!!!") == "Hello"
Repeats the given string the given number of times.
String.repeat(5, "A") == "AAAAA"
Replaces the given pattern with the replacements.
String.replace("a", "0", "aaaa") == "0000"
Reverses the given string.
String.reverse("ABC") == "CBA"
Returns number of characters in the given string.
String.size("ABC") == 3
Splits the given string using the given separator.
String.split("", "AAA") = ["A", "A", "A"]
Convert the given string into an array of strings.
String.toArray("AAA") = ["A", "A", "A"]
Converts the given string to lowercase.
String.toLowerCase("ABC") == "abc"
Converts the given string to lowercase.
String.toUpperCase("abc") == "ABC"
Removes whitespace from the beginning and end of the string.
String.trim(" asd ") == "asd"
Returns the given string or the given default value if the string is empty.
String.withDefault("default", "") == "default"
String.withDefault("default", "something") == "something"
Wraps the string with the given start and end characters.
String.wrap("{","}", "Hello there!") == "{Hello there!}"