MayrStringExtensions extension

on

Properties

isBlank bool

Available on String, provided by the MayrStringExtensions extension

Checks if the string is empty or contains only whitespace.
no setter
isNotBlank bool

Available on String, provided by the MayrStringExtensions extension

Checks if the string is not empty and contains non-whitespace characters.
no setter

Methods

countOccurrences(String substring) int

Available on String, provided by the MayrStringExtensions extension

Counts the number of occurrences of a substring within the string.
limit(int maxLength, [String overflow = "..."]) String

Available on String, provided by the MayrStringExtensions extension

Limit the string to a maximum length with optional overflow indicator.
mask({int start = 2, int end = 2, String maskChar = '*', int? maskLength}) String

Available on String, provided by the MayrStringExtensions extension

Mask the string by replacing characters with a mask character.
matchesRegExp(String regex) bool

Available on String, provided by the MayrStringExtensions extension

Checks if the string matches the given regex
removePrefix(String prefix) String

Available on String, provided by the MayrStringExtensions extension

Removes the specified prefix from the string if it exists.
removeSuffix(String suffix) String

Available on String, provided by the MayrStringExtensions extension

Removes the specified suffix from the string if it exists.
removeWhitespace() String

Available on String, provided by the MayrStringExtensions extension

Removes all whitespace from the string.
reverse() String

Available on String, provided by the MayrStringExtensions extension

Reverses the string.
toBool([bool? fallback]) bool

Available on String, provided by the MayrStringExtensions extension

Attempts to convert the string to a boolean.
toDateTime() DateTime?

Available on String, provided by the MayrStringExtensions extension

Attempt to convert a String to a DateTime.
toRegExp() RegExp

Available on String, provided by the MayrStringExtensions extension

Converts a string to a RegExp
toUri() Uri?

Available on String, provided by the MayrStringExtensions extension

Attempt to convert a string to a Uri.
truncate(int maxLength, {String ellipsis = '...'}) String

Available on String, provided by the MayrStringExtensions extension

Truncates the string to a specified length and adds an ellipsis if needed.
wrap(String prefix, [String? suffix]) String

Available on String, provided by the MayrStringExtensions extension

Wraps the string with the specified prefix and suffix.