StringBasics extension

Utility extension methods for the native String class.

on

Properties

isBlank bool

Available on String, provided by the StringBasics extension

Returns true if this is empty or consists solely of whitespace characters as defined by String.trim.
no setter
isNotBlank bool

Available on String, provided by the StringBasics extension

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

Available on String, provided by the StringBasics extension

Returns a string with the first character in upper case.
compareToIgnoringCase(String other) int

Available on String, provided by the StringBasics extension

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

Available on String, provided by the StringBasics extension

Returns a copy of this with other inserted starting at index.
partition(Pattern pattern) List<String>

Available on String, provided by the StringBasics extension

Divides string into everything before pattern, pattern, and everything after pattern.
prepend(String other) String

Available on String, provided by the StringBasics extension

Returns the concatenation of other and this.
reverse() String

Available on String, provided by the StringBasics extension

Returns this with characters in reverse order.
slice({int? start, int? end, int step = 1}) String

Available on String, provided by the StringBasics extension

Returns a new string containing the characters of this from start inclusive to end exclusive, skipping by step.
truncate(int length, {String substitution = '', bool trimTrailingWhitespace = true, bool includeSubstitutionInLength = false}) String

Available on String, provided by the StringBasics extension

Returns a truncated version of the string.
withoutPrefix(Pattern prefix) String

Available on String, provided by the StringBasics extension

Returns a copy of this with prefix removed if it is present.
withoutSuffix(Pattern suffix) String

Available on String, provided by the StringBasics extension

Returns a copy of this with suffix removed if it is present.