StringExtensions extension
- on
Properties
- capitalize → String
-
Available on String, provided by the StringExtensions extension
Capitalize first letterno setter - digitsOnly → String
-
Available on String, provided by the StringExtensions extension
Extract only digits (handy for phone numbers)no setter - fromBase64 → String?
-
Available on String, provided by the StringExtensions extension
Decode base64 string (if valid)no setter - isNotEmptyOrNull → bool
-
Available on String, provided by the StringExtensions extension
Check if string is not empty (for convenience)no setter - isNullOrEmpty → bool
-
Available on String, provided by the StringExtensions extension
Check if string is null, empty or only whitespaceno setter - isNumeric → bool
-
Available on String, provided by the StringExtensions extension
Check if string is numericno setter - isValidEmail → bool
-
Available on String, provided by the StringExtensions extension
Check if string is a valid emailno setter - isValidUrl → bool
-
Available on String, provided by the StringExtensions extension
Check if string is a valid URLno setter - removeSpaces → String
-
Available on String, provided by the StringExtensions extension
Remove all spacesno setter - reversed → String
-
Available on String, provided by the StringExtensions extension
Reverse the stringno setter - titleCase → String
-
Available on String, provided by the StringExtensions extension
Capitalize all wordsno setter - toBase64 → String
-
Available on String, provided by the StringExtensions extension
Encode string to base64no setter - toCamelCase → String
-
Available on String, provided by the StringExtensions extension
Convert snake_case or kebab-case to camelCaseno setter
Methods
-
countOccurrences(
String substring) → int -
Available on String, provided by the StringExtensions extension
Count how many times a substring occurs -
ellipsize(
int maxLength) → String -
Available on String, provided by the StringExtensions extension
Limit string length (adds "..." if too long) -
equalsIgnoreCase(
String other) → bool -
Available on String, provided by the StringExtensions extension
Safe compare ignoring case -
safeSubstring(
int start, [int? end]) → String -
Available on String, provided by the StringExtensions extension
Safe substring (won't throw if string is too short) -
surround(
{String left = '"', String right = '"'}) → String -
Available on String, provided by the StringExtensions extension
Surround string with quotes (or custom characters) -
toDouble(
{double fallback = 0.0}) → double -
Available on String, provided by the StringExtensions extension
Safe double parsing with fallback -
toDoubleOrNull(
) → double? -
Available on String, provided by the StringExtensions extension
Convert to double (returns null if not a valid number) -
toInt(
{int fallback = 0}) → int -
Available on String, provided by the StringExtensions extension
Safe int parsing with fallback -
toIntOrNull(
) → int? -
Available on String, provided by the StringExtensions extension
Convert to int (returns null if not a valid number) -
withPrefix(
String prefix) → String -
Available on String, provided by the StringExtensions extension
Add a prefix if missing -
withSuffix(
String suffix) → String -
Available on String, provided by the StringExtensions extension
Add a suffix if missing