strings
library
Functions
-
center(String? input, int width, String fill)
→ String
-
Returns a String of length
width
padded with the same number of
characters on the left and right from fill
. On the right, characters are
selected from fill
starting at the end so that the last character in
fill
is the last character in the result. fill
is repeated if
necessary to pad.
-
compareIgnoreCase(String a, String b)
→ int
-
Compares
a
and b
after converting to lower case.
-
equalsIgnoreCase(String? a, String? b)
→ bool
-
Returns
true
if a
and b
are equal after being converted to lower
case, or are both null.
-
isBlank(String? s)
→ bool
-
Returns
true
if s
is either null, empty or is solely made of whitespace
characters (as defined by String.trim).
-
isDigit(int rune)
→ bool
-
Returns
true
if rune
represents a digit.
-
isEmpty(String? s)
→ bool
-
Returns
true
if s
is either null or empty.
-
isNotBlank(String? s)
→ bool
-
Returns
true
if s
is neither null, empty nor is solely made of whitespace
characters.
-
isNotEmpty(String? s)
→ bool
-
Returns
true
if s
is a not empty string.
-
isWhitespace(int rune)
→ bool
-
Returns
true
if rune
represents a whitespace character.
-
loop(String s, int from, [int? to])
→ String
-
Loops over
s
and returns traversed characters. Takes arbitrary from
and
to
indices. Works as a substitute for String.substring, except it never
throws RangeError. Supports negative indices. Think of an index as a
coordinate in an infinite in both directions vector filled with repeating
string s
, whose 0-th coordinate coincides with the 0-th character in s
.
Then loop returns the sub-vector defined by the interval (from
, to
).
from
is inclusive. to
is exclusive.