StringExtension extension
Properties
-
last
→ String
-
Returns last symbol of string or empty string if
this
is null or empty
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
-
capitalize()
→ String
-
Capitalize the first string
If the string is null or empty return default string.
-
containsIgnoreCase(String? other)
→ bool
-
Returns
true
if string contains another without matching case
-
equalsIgnoreCase(String? other)
→ bool
-
Returns
true
if strings are equals without matching case
-
isNotNullOrEmpty()
→ bool
-
Returns
false
if this nullable char sequence is either null
or empty.
-
isNullOrEmpty()
→ bool
-
Returns
true
if this nullable char sequence is either null
or empty.
-
removeLast()
→ String
-
remove last String
If the string is null or empty return default string.
-
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.
-
replaceLast(String substring, String replacement)
→ String
-
Replace last String with
replacement
string.
If the string is null or empty return default string.
-
reversed()
→ String
-
Returns a progression that goes over the same range in the opposite direction with the same step.
-
toDouble()
→ double
-
Returns the value of this number as an double
-
toDoubleOrNull()
→ double?
-
Returns the value of this number as an double or null if can not be parsed.
-
toInt()
→ int
-
Returns the value of this number as an int
-
toIntOrNull()
→ int?
-
Returns the value of this number as an int or null if can not be parsed.