StringBasics extension
Utility extension methods for the native String class.
- on
Properties
- isBlank → bool
-
Returns
true
if this is empty or consists solely of whitespace characters as defined by String.trim.no setter - isNotBlank → bool
-
Returns
true
if this is not empty and does not consist solely of whitespace characters as defined by String.trim.no setter
Methods
-
capitalize(
) → String - Returns a string with the first character in upper case.
-
compareToIgnoringCase(
String other) → int -
Returns a value according to the contract for Comparator indicating
the ordering between this and
other
, ignoring letter case. -
insert(
String other, int index) → String -
Returns a copy of this with
other
inserted starting atindex
. -
partition(
Pattern pattern) → List< String> -
Divides string into everything before
pattern
,pattern
, and everything afterpattern
. -
prepend(
String other) → String -
Returns the concatenation of
other
and this. -
reverse(
) → String - Returns this with characters in reverse order.
-
slice(
{int? start, int? end, int step = 1}) → String -
Returns a new string containing the characters of this from
start
inclusive toend
exclusive, skipping bystep
. -
truncate(
int length, {String substitution = '', bool trimTrailingWhitespace = true, bool includeSubstitutionInLength = false}) → String - Returns a truncated version of the string.
-
withoutPrefix(
Pattern prefix) → String -
Returns a copy of this with
prefix
removed if it is present. -
withoutSuffix(
Pattern suffix) → String -
Returns a copy of this with
suffix
removed if it is present.