StringExtensions extension

Extension function on string.

on

Properties

capitalizeFirstChar String
Extension function to capitalize first character of a string.
no setter
capitalizeFirstCharForEachWord String
Extension function to capitalize first character of each word of string.
no setter
firstOrNull String?
Returns first symbol of string or null string if it's empty
no setter
isPalindrome bool
Checks if string is Palindrome.
no setter
lastOrEmpty String
Returns last symbol of string or empty string if it's empty
no setter
lastOrNull String?
Returns first symbol of string or null string if it's empty
no setter
linesCount int
return string lines count
no setter
reversed String
Reverse a string
no setter

Methods

anyChar(bool predicate(String element)) bool
Returns true if at least one element matches the given predicate. the predicate should have only one character
format(List arguments) String
Formats the string with the given arguments. Example:
replaceAfter(String delimiter, String replacement, [String? defaultValue]) String
Replaces part of string after the first occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns defaultValue which defaults to the original string.
replaceBefore(String delimiter, String replacement, [String? defaultValue]) String
Replaces part of string before the first occurrence of given delimiter with the replacement string. If the string does not contain the delimiter, returns missingDelimiterValue! which defaults to the original string.
toBoolean() bool
Converts the string to boolean.