StringUtilities extension

on

Methods

after(String string) String
Get the substring of a string after a string.
afterFirst(String string) String
Get the substring of a string after the first occurrence of a string.
afterLast(String string) String
Get the substring of a string after the last occurrence of a string.
append(String string) String
Append a string.
before(String string) String
Get the substring of a string before a string.
beforeFirst(String string) String
Get the substring of a string before the first occurrence of a string.
beforeLast(String string) String
Get the substring of a string before the last occurrence of a string.
between(String start, String end) String
Get the substring of a string between two strings.
betweenFirst(String start, String end) String
Get the substring of a string between the first occurrence of two strings.
betweenLast(String start, String end) String
Get the substring of a string between the last occurrence of two strings.
capitalize() String
Returns a string with the first character in upper case.
charCount() int
Get the number of characters in a string.
consonantCount() int
Get the number of consonants in a string.
constantize() String
Converts a string into a constant name.
containsIgnoreCase(String string) bool
Check if a string contains a substring.
dropLeft(int n) String
Drop first n characters from a string.
dropLeftWhile(bool condition(String)) String
Drop left while the condition is met.
dropRight(int n) String
Drop last n characters from a string.
dropRightWhile(bool condition(String)) String
Drop right while the condition is met.
endsWith(String string) bool
Check if a string ends with a substring.
escape() String
Escape a string.
foreignKey() String
Converts a string into a foreign key name.
format(List<Object> args) String
Format a string.
formatMap(Map<String, Object> args) String
Format a string.
humanize() String
Converts a string into a human-readable form.
isDigits() bool
Check if a string contains only digits.
isEmail() bool
Check if a string is a valid email address.
isHexColor() bool
Check if a string is a valid hexadecimal color.
isPalindrome() bool
Check if a string is a palindrome.
pathize() String
Converts a string into a path name.
pluralize() String
Convert a string into plural form.
prepend(String string) String
Prepend a string.
remove(String string) String
Remve prefix and suffix from a string.
removePrefix(String prefix) String
Remve prefix from a string.
removeSuffix(String suffix) String
Remve suffix from a string.
replaceAfterFirst(String string, String replacement) String
Replace after the first occurrence of a string.
replaceAfterLast(String string, String replacement) String
Replace after the last occurrence of a string.
replaceBeforeFirst(String string, String replacement) String
Replace before the first occurrence of a string.
replaceBeforeLast(String string, String replacement) String
Replace before the last occurrence of a string.
replaceRange(int start, int end, String replacement) String
Replace range of characters.
sentenceCount() int
Get the number of sentences in a string.
sequenceize() String
Converts a string into a sequence name.
startsWith(String string) bool
Check if a string starts with a substring.
syllableCount() int
Get the number of syllables in a string.
tableize() String
Converts a string into a table name.
titleCase() String
Capitalizes the first character of each word in a string.
toBase64() String
toBytes() List<int>
Convert string to bytes.
toCamelCase() String
Convert string to camel case.
toColor() Color?
Convert to color from hex string. Returns null if the string is not a valid hex color.
toDotCase() String
Convert string to dot case.
toHtmlText() String
Convert to HTML Text.
toKebabCase() String
Convert string to kebab case.
toPascalCase() String
Convert string to pascal case.
toSnakeCase() String
Convert string to snake case.
toTrainCase() String
Convert string to train case.
uncapitalize() String
Returns a string with the first character in lower case.
underscore() String
Converts a camelized string into all lower case separated by underscores.
variablize() String
Converts a string into a variable name.
vowelCount() int
Get the number of vowels in a string.
wordCount() int
Get the number of words in a string.