StringX extension
Methods
capitalize ()
→ String
Returns a copy of this string having its first letter uppercased, or the
original string, if it's empty or already starts with an upper case
letter.
decapitalize ()
→ String
Returns a copy of this string having its first letter lowercased, or the
original string, if it's empty or already starts with a lower case letter.
removePrefix (String prefix )
→ String
If this String starts with the given prefix
, returns a copy of this
string with the prefix removed. Otherwise, returns this String .
removeSuffix (String suffix )
→ String
If this String ends with the given suffix
, returns a copy of this
String with the suffix removed. Otherwise, returns this String .
removeSurrounding ({required String prefix , required String suffix })
→ String
Removes from a String both the given prefix
and suffix
if and only
if it starts with the prefix
and ends with the suffix
.
Otherwise returns this String unchanged.
slice (int start , [int end = -1 ])
→ String
Returns a new substring containing all characters between start
(inclusive) and end
(inclusive).
If end
is omitted, it is being set to lastIndex
.
toDouble ()
→ double
Parses the string as a double number and returns the result.
toDoubleOrNull ()
→ double ?
Parses the string as an double number and returns the result or null
if the string is not a valid representation of a number.
toInt ({int ? radix })
→ int
Parses the string as an int number and returns the result.
toIntOrNull ({int ? radix })
→ int ?
Parses the string as an int number and returns the result or null
if
the string is not a valid representation of a number.
toUtf16 ()
→ List <int >
toUtf8 ()
→ List <int >
dartx_nullsafety 0.6.0-nullsaftety.0