ObjStringExt extension
Properties
-
codeUnits
→ List<int>
-
An unmodifiable list of the UTF-16 code units of this string.
no setter
-
isEmpty
→ bool
-
Whether this string is empty.
no setter
-
isNotEmpty
→ bool
-
Whether this string is not empty.
no setter
-
length
→ int
-
The length of the string.
no setter
-
runes
→ Runes
-
An Iterable of Unicode code-points of this string.
no setter
Methods
-
codeUnitAt(int index)
→ int
-
Returns the 16-bit UTF-16 code unit at the given
index
.
-
compareTo(String other)
→ int
-
Compares this string to
other
.
-
contains(Pattern other, [int startIndex = 0])
→ bool
-
Whether this string contains a match of
other
.
-
endsWith(String other)
→ bool
-
Whether this string ends with
other
.
-
indexOf(Pattern pattern, [int start = 0])
→ int
-
Returns the position of the first match of
pattern
in this string,
starting at start
, inclusive:
-
lastIndexOf(Pattern pattern, [int? start])
→ int
-
The starting position of the last match
pattern
in this string.
-
padLeft(int width, [String padding = ' '])
→ String
-
Pads this string on the left if it is shorter than
width
.
-
padRight(int width, [String padding = ' '])
→ String
-
Pads this string on the right if it is shorter than
width
.
-
replaceAll(Pattern from, String replace)
→ String
-
Replaces all substrings that match
from
with replace
.
-
replaceAllMapped(Pattern from, String replace(Match match))
→ String
-
Replace all substrings that match
from
by a computed string.
-
replaceFirst(Pattern from, String to, [int startIndex = 0])
→ String
-
Creates a new string with the first occurrence of
from
replaced by to
.
-
replaceFirstMapped(Pattern from, String replace(Match match), [int startIndex = 0])
→ String
-
Replace the first occurrence of
from
in this string.
-
replaceRange(int start, int? end, String replacement)
→ String
-
Replaces the substring from
start
to end
with replacement
.
-
split(Pattern pattern)
→ List<String>
-
Splits the string at matches of
pattern
and returns a list of substrings.
-
splitMapJoin(Pattern pattern, {String onMatch(Match)?, String onNonMatch(String)?})
→ String
-
Splits the string, converts its parts, and combines them into a new
string.
-
startsWith(Pattern pattern, [int index = 0])
→ bool
-
Whether this string starts with a match of
pattern
.
-
substring(int start, [int? end])
→ String
-
The substring of this string from
start
, inclusive, to end
, exclusive.
-
toLowerCase()
→ String
-
Converts all characters in this string to lower case.
-
toUpperCase()
→ String
-
Converts all characters in this string to upper case.
-
trim()
→ String
-
The string without any leading and trailing whitespace.
-
trimLeft()
→ String
-
The string without any leading whitespace.
-
trimRight()
→ String
-
The string without any trailing whitespace.