StringExtensions extension

Extensions for String operations and utilities.

on

Properties

isAlpha bool

Available on String, provided by the StringExtensions extension

Checks if the string contains only alphabetic characters.
no setter
isAlphanumeric bool

Available on String, provided by the StringExtensions extension

Checks if the string contains only alphanumeric characters.
no setter
isBlank bool

Available on String, provided by the StringExtensions extension

Returns true if the string is blank (empty or contains only whitespace).
no setter
isNotBlank bool

Available on String, provided by the StringExtensions extension

Returns true if the string is not blank.
no setter
isNotNullOrEmpty bool

Available on String, provided by the StringExtensions extension

Returns true if the string is not null and not empty.
no setter
isNullOrEmpty bool

Available on String, provided by the StringExtensions extension

Returns true if the string is null or empty.
no setter
isNumeric bool

Available on String, provided by the StringExtensions extension

Checks if the string contains only numeric characters.
no setter
isValidEmail bool

Available on String, provided by the StringExtensions extension

Checks if the string is a valid email address.
no setter
isValidPhone bool

Available on String, provided by the StringExtensions extension

Checks if the string is a valid phone number.
no setter
isValidUrl bool

Available on String, provided by the StringExtensions extension

Checks if the string is a valid URL.
no setter

Methods

capitalize() String

Available on String, provided by the StringExtensions extension

Capitalizes the first letter of the string.
capitalizeWords() String

Available on String, provided by the StringExtensions extension

Capitalizes the first letter of each word in the string.
endsWithAny(Iterable<String> suffixes) bool

Available on String, provided by the StringExtensions extension

Checks if the string ends with any of the provided suffixes.
extractNumbers() String

Available on String, provided by the StringExtensions extension

Extracts all numbers from the string.
findAll(Pattern pattern) List<String>

Available on String, provided by the StringExtensions extension

Returns a list of all substrings that match the pattern.
padLeft(int width, [String padding = ' ']) String

Available on String, provided by the StringExtensions extension

Pads the string on the left to the specified width.
padRight(int width, [String padding = ' ']) String

Available on String, provided by the StringExtensions extension

Pads the string on the right to the specified width.
remove(String substring) String

Available on String, provided by the StringExtensions extension

Removes all occurrences of the specified substring.
removeFirst(int n) String

Available on String, provided by the StringExtensions extension

Returns the string with the first n characters removed.
removeLast(int n) String

Available on String, provided by the StringExtensions extension

Returns the string with the last n characters removed.
removeWhitespace() String

Available on String, provided by the StringExtensions extension

Removes all whitespace characters from the string.
replaceFirst(String oldValue, String newValue) String

Available on String, provided by the StringExtensions extension

Replaces the first occurrence of oldValue with newValue.
replaceLast(String oldValue, String newValue) String

Available on String, provided by the StringExtensions extension

Replaces the last occurrence of oldValue with newValue.
reverse() String

Available on String, provided by the StringExtensions extension

Reverses the string.
startsWithAny(Iterable<String> prefixes) bool

Available on String, provided by the StringExtensions extension

Checks if the string starts with any of the provided prefixes.
toSlug() String

Available on String, provided by the StringExtensions extension

Converts the string to a slug (URL-friendly format).
trimWhitespace() String

Available on String, provided by the StringExtensions extension

Removes all leading and trailing whitespace.
truncate(int maxLength, {String ellipsis = '...'}) String

Available on String, provided by the StringExtensions extension

Truncates the string to the specified length with optional ellipsis.
wrap(int width) List<String>

Available on String, provided by the StringExtensions extension

Wraps the string to the specified width.