StringBasics extension
Utility extension methods for the native String class.
- on
Properties
- isBlank → bool
-
Available on String, provided by the StringBasics extension
Returnstrue
ifthis
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
Returnstrue
ifthis
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 betweenthis
andother
, ignoring letter case. -
insert(
String other, int index) → String -
Available on String, provided by the StringBasics extension
Returns a copy ofthis
withother
inserted starting atindex
. -
partition(
Pattern pattern) → List< String> -
Available on String, provided by the StringBasics extension
Divides string into everything beforepattern
,pattern
, and everything afterpattern
. -
prepend(
String other) → String -
Available on String, provided by the StringBasics extension
Returns the concatenation ofother
andthis
. -
reverse(
) → String -
Available on String, provided by the StringBasics extension
Returnsthis
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 ofthis
fromstart
inclusive toend
exclusive, skipping bystep
. -
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 ofthis
withprefix
removed if it is present. -
withoutSuffix(
Pattern suffix) → String -
Available on String, provided by the StringBasics extension
Returns a copy ofthis
withsuffix
removed if it is present.