See https://pub.dev/packages/quiver instead!
A set of string utilities for Dart.
isBlank
checks if a string is null
, empty or made of whitespace characters.
isEmpty
checks if a string is null
or empty.
isNotEmpty
checks if a string is not null
and not empty.
equalsIgnoreCase
checks if two strings are equal, ignoring case.
compareIgnoreCase
compares two strings, ignoring case.
reverse
reverses the order of characters in a string.
nullToEmpty
turns null
to empty string, and returns non-empty strings
unchanged.
emptyToNull
turns empty string to null
, and returns non-empty strings
unchanged.
loop
allows you to loop through characters in a string starting and ending at
arbitrary indices. Out of bounds indices allow you to wrap around the string,
supporting a number of use-cases, including:
- Rotating:
loop('lohel', -3, 2) => 'hello'
- Repeating, like
repeat
, but with better character-level control, e.g.:loop('la ', 0, 8) => 'la la la' // no tailing space
- Tailing:
loop('/path/to/some/file.txt', -3) => 'txt'
- Reversing:
loop('top', 3, 0) => 'pot'