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 tocamelCase.no setter - toKebabCase → String
-
Available on String, provided by the StringX extension
Converts tokebab-case.no setter - toNullIfBlank → String?
-
Available on String, provided by the StringX extension
Returnsnullwhen blank.no setter - toSnakeCase → String
-
Available on String, provided by the StringX extension
Converts tosnake_case.no setter
Methods
-
ellipsize(
int maxLength, {String ellipsis = '...'}) → String -
Available on String, provided by the StringX extension
Truncates string tomaxLengthcharacters, appendingellipsis. -
mask(
{int visible = 4, String maskChar = '•'}) → String -
Available on String, provided by the StringX extension
Masks all but the lastvisiblecharacters. -
toBoolOrNull(
) → bool? -
Available on String, provided by the StringX extension
Parses as bool. -
toDate(
) → DateTime? -
Available on String, provided by the StringX extension
Parses this string as a DateTime, or returnsnullon failure. -
toDoubleOr(
[double fallback = 0]) → double -
Available on String, provided by the StringX extension
Parses as double, returningfallbackon failure. -
toIntOr(
[int fallback = 0]) → int -
Available on String, provided by the StringX extension
Parses as int, returningfallbackon failure. -
toSlug(
) → String - Converts this string to URL-friendly slug (e.g. 'Hello World!' -> 'hello-world').
-
toTitleCase(
) → String - Converts this string to title case (e.g. 'hello world' -> 'Hello World').
-
truncate(
int maxLength, {String suffix = '…'}) → String -
Available on String, provided by the StringX extension
Truncates the string tomaxLengthcharacters, appendingsuffix.