StringX extension

on

Properties

chars Iterable<String>
The characters of a string.
no setter
isAscii bool
no setter
isBlank bool
Returns true if this string is empty or consists solely of whitespace characters.
no setter
isCapitalized bool
Returns true if the first character is upper case.
no setter
isDecapitalized bool
Returns true if the first character is lower case.
no setter
isDouble bool
no setter
isInt bool
no setter
isLatin1 bool
no setter
isLowerCase bool
Returns true if the whole string is lower case.
no setter
isNotBlank bool
Returns true if this char sequence is not empty and contains some characters except of whitespace characters.
no setter
isNotNullOrEmpty bool
no setter
isNullOrEmpty bool
Returns true if the String is either null or empty.
no setter
isUpperCase bool
Returns true if the whole string is upper case.
no setter
md5 String
Calculates the MD5 digest and returns the value as a String of hexadecimal digits.
no setter
reversed String
Returns a new string with characters in reversed order.
no setter

Methods

capitalize() String
Returns a copy of this string having its first letter uppercased, or the original string, if it's empty or already starts with an upper case letter.
decapitalize() String
Returns a copy of this string having its first letter lowercased, or the original string, if it's empty or already starts with a lower case letter.
removePrefix(String prefix) String
If this String starts with the given prefix, returns a copy of this string with the prefix removed. Otherwise, returns this String.
removeSuffix(String suffix) String
If this String ends with the given suffix, returns a copy of this String with the suffix removed. Otherwise, returns this String.
removeSurrounding({required String prefix, required String suffix}) String
Removes from a String both the given prefix and suffix if and only if it starts with the prefix and ends with the suffix. Otherwise returns this String unchanged.
slice(int start, [int end = -1]) String
Returns a new substring containing all characters between start (inclusive) and end (inclusive). If end is omitted, it is being set to lastIndex.
toDouble() double
Parses the string as a double number and returns the result.
toDoubleOrNull() double?
Parses the string as an double number and returns the result or null if the string is not a valid representation of a number.
toInt({int? radix}) int
Parses the string as an int number and returns the result.
toIntOrNull({int? radix}) int?
Parses the string as an int number and returns the result or null if the string is not a valid representation of a number.
toUtf16() List<int>
toUtf8() List<int>