StringExt extension

Extension on String providing various string manipulation and validation utilities.

This extension adds helpful methods for string operations like truncation, substring extraction, and pattern validation.

on

Properties

containsOnlyNumbers → bool

Available on String, provided by the StringExt extension

Returns true if this string contains only numeric digits (0-9).
no setter
startsWithPlusAndContainsOnlyNumbers → bool

Available on String, provided by the StringExt extension

Returns true if this string starts with a plus sign and contains only numeric digits after it.
no setter

Methods

isAnyOf(List<String> items) → bool

Available on String, provided by the StringExt extension

Returns true if this string is equal to any string in items.
takeAfter(String search) → String

Available on String, provided by the StringExt extension

Returns the substring after the first occurrence of search.
takeAfterLast(String search) → String

Available on String, provided by the StringExt extension

Returns the substring after the last occurrence of search.
takeLeft(int characterCount, {bool addEllipses = false}) → String

Available on String, provided by the StringExt extension

Returns the leftmost characterCount characters of this string.

Static Properties

regexNumbersOnly ↔ RegExp

Available on String, provided by the StringExt extension

Regular expression pattern for matching strings containing only digits (0-9).
getter/setter pair
regexStartsWithPlusAndThenOnlyNumbers ↔ RegExp

Available on String, provided by the StringExt extension

Regular expression pattern for matching strings that start with a plus sign followed by only digits.
getter/setter pair