StringExtensions extension

Comprehensive String extensions for Flutter applications

Provides utility methods for common string operations including capitalization, validation, formatting, and transformation.

on

Properties

capitalizeFirst String

Available on String, provided by the StringExtensions extension

Capitalizes the first letter while preserving the rest
no setter
capitalizeFirstOfEach String

Available on String, provided by the StringExtensions extension

Capitalizes the first letter of each word
no setter
fileExtension String

Available on String, provided by the StringExtensions extension

Gets file extension from file path/name
no setter
fileNameWithoutExtension String

Available on String, provided by the StringExtensions extension

Gets filename without extension
no setter
hasValidAudioExtension bool

Available on String, provided by the StringExtensions extension

no setter
hasValidImageExtension bool

Available on String, provided by the StringExtensions extension

Checks if string is a valid file extension
no setter
hasValidVideoExtension bool

Available on String, provided by the StringExtensions extension

no setter
isAlpha bool

Available on String, provided by the StringExtensions extension

Checks if string contains only alphabetic characters
no setter
isAlphaNumeric bool

Available on String, provided by the StringExtensions extension

Checks if string contains only alphanumeric characters
no setter
isNumeric bool

Available on String, provided by the StringExtensions extension

Checks if string contains only numeric characters
no setter
isPalindrome bool

Available on String, provided by the StringExtensions extension

Checks if string is palindrome
no setter
isValidEmail bool

Available on String, provided by the StringExtensions extension

Checks if string is a valid email
no setter
isValidPhone bool

Available on String, provided by the StringExtensions extension

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

Available on String, provided by the StringExtensions extension

Checks if string is a valid URL
no setter
removeAt String

Available on String, provided by the StringExtensions extension

Removes '@' from the beginning if present
no setter
startsWithAt String

Available on String, provided by the StringExtensions extension

Ensures the string starts with '@' for usernames
no setter
startsWithHash String

Available on String, provided by the StringExtensions extension

Ensures the string starts with '#' for hashtags
no setter

Methods

addThousandSeparators({String separator = ','}) String

Available on String, provided by the StringExtensions extension

Adds thousand separators to numeric string
capitalizeFirstLetter() String

Available on String, provided by the StringExtensions extension

Capitalizes only the first letter of the string
countOccurrences(String substring) int

Available on String, provided by the StringExtensions extension

Counts occurrences of substring
formatAsCurrency({String symbol = '\$'}) String

Available on String, provided by the StringExtensions extension

Formats string as currency
formatAsPhone() String

Available on String, provided by the StringExtensions extension

Formats string as phone number
getInitials([int? maxInitials]) String

Available on String, provided by the StringExtensions extension

Gets initials from full name
maskCreditCard() String

Available on String, provided by the StringExtensions extension

maskEmail() String

Available on String, provided by the StringExtensions extension

Masks string for privacy (e.g., credit cards, emails)
removeExtraWhitespace() String

Available on String, provided by the StringExtensions extension

Removes extra whitespace (multiple spaces become single space)
removeWhitespace() String

Available on String, provided by the StringExtensions extension

Removes all whitespace characters
repeat(int times) String

Available on String, provided by the StringExtensions extension

Repeats string n times
reverse() String

Available on String, provided by the StringExtensions extension

Reverses the string
toCamelCase() String

Available on String, provided by the StringExtensions extension

Converts string to camelCase
toColor() Color?

Available on String, provided by the StringExtensions extension

Converts hex color string to Color object
toKebabCase() String

Available on String, provided by the StringExtensions extension

Converts string to kebab-case
toPascalCase() String

Available on String, provided by the StringExtensions extension

Converts string to PascalCase
toSentenceCase() String

Available on String, provided by the StringExtensions extension

Converts to sentence case (first letter of sentence capitalized)
toSnakeCase() String

Available on String, provided by the StringExtensions extension

Converts string to snake_case
toTitleCase() String

Available on String, provided by the StringExtensions extension

Converts to title case (each word capitalized)
truncate(int maxLength, {String ellipsis = '...'}) String

Available on String, provided by the StringExtensions extension

Truncates string to specified length with ellipsis
wrap(String wrapper, [String? endWrapper]) String

Available on String, provided by the StringExtensions extension

Wraps string with specified characters