StringX extension

String validation and transformation extensions.

on

Properties

capitalize → String

Available on String, provided by the StringX extension

Capitalizes the first letter.
no setter
capitalizeWords → String

Available on String, provided by the StringX extension

Capitalizes the first letter of every word.
no setter
isAlpha → bool

Available on String, provided by the StringX extension

Whether this string contains only letters.
no setter
isAlphanumeric → bool

Available on String, provided by the StringX extension

Whether this string contains only letters and digits.
no setter
isBlank → bool

Available on String, provided by the StringX extension

Whether this string is empty or only whitespace.
no setter
isDigits → bool

Available on String, provided by the StringX extension

Whether this string contains only digits.
no setter
isEmail → bool

Available on String, provided by the StringX extension

Whether this string is a valid email address.
no setter
isInt → bool

Available on String, provided by the StringX extension

Whether this string is an integer.
no setter
isNumber → bool

Available on String, provided by the StringX extension

Whether this string is a number (integer or decimal).
no setter
isPhoneNumber → bool

Available on String, provided by the StringX extension

Whether this string is a valid phone number (loose check).
no setter
isStrongPassword → bool

Available on String, provided by the StringX extension

Whether this string has a strong password shape (>= 8 chars, upper, lower, digit).
no setter
isUrl → bool

Available on String, provided by the StringX extension

Whether this string is a valid URL.
no setter
onlyDigits → String

Available on String, provided by the StringX extension

Keeps only digit characters.
no setter
removeWhitespace → String

Available on String, provided by the StringX extension

Removes all whitespace.
no setter
toCamelCase → String

Available on String, provided by the StringX extension

Converts to camelCase.
no setter
toKebabCase → String

Available on String, provided by the StringX extension

Converts to kebab-case.
no setter
toNullIfBlank → String?

Available on String, provided by the StringX extension

Returns null when blank.
no setter
toSnakeCase → String

Available on String, provided by the StringX extension

Converts to snake_case.
no setter

Methods

mask({int visible = 4, String maskChar = '•'}) → String

Available on String, provided by the StringX extension

Masks all but the last visible characters.
toBoolOrNull() → bool?

Available on String, provided by the StringX extension

Parses as bool.
toDoubleOr([double fallback = 0]) → double

Available on String, provided by the StringX extension

Parses as double, returning fallback on failure.
toIntOr([int fallback = 0]) → int

Available on String, provided by the StringX extension

Parses as int, returning fallback on failure.
truncate(int maxLength, {String suffix = '…'}) → String

Available on String, provided by the StringX extension

Truncates the string to maxLength characters, appending suffix.