StringExtension extension

on

Properties

date DateTime?

Available on String, provided by the StringExtension extension

Returns DateTime if string is a date string like "2025-01-01 12:00:00"
no setter
dateOnly DateTime?

Available on String, provided by the StringExtension extension

Returns DateTime if string is a date string like "2025-01-01"
no setter
isCreditCard bool

Available on String, provided by the StringExtension extension

Returns true if string is a valid credit card number
no setter
isDate bool

Available on String, provided by the StringExtension extension

Returns true if string is a date
no setter
isEmail bool

Available on String, provided by the StringExtension extension

Returns true if string contains email
no setter
isJson bool

Available on String, provided by the StringExtension extension

Returns true if string is a valid JSON string
no setter
isQuery bool

Available on String, provided by the StringExtension extension

Validates URL query string (handles ? & # fragments, allows empty values)
no setter
isStrongPassword bool

Available on String, provided by the StringExtension extension

Returns true if string match strong password requirements
no setter
isTime bool

Available on String, provided by the StringExtension extension

Returns true if string is a time
no setter
time Time?

Available on String, provided by the StringExtension extension

Returns Time if string is a time string like "12:00:00"
no setter
timeOnly Time?

Available on String, provided by the StringExtension extension

Returns Time if string is a time string like "12:00:00"
no setter

Methods

bytes() List<int>

Available on String, provided by the StringExtension extension

Returns a list of the UTF-16 code units of the string.
bytesChunks(int chunkSize) List<List<int>>

Available on String, provided by the StringExtension extension

Splits the string's UTF-16 code units (bytes) into a list of chunks.
bytesCount() int

Available on String, provided by the StringExtension extension

Calculates the byte count of a string, treating non-ASCII characters as 2 bytes.
capitalize() String

Available on String, provided by the StringExtension extension

Returns string with capitalized first letter
chunks(int chunkSize) List<String>

Available on String, provided by the StringExtension extension

Splits the string into a list of chunks of a specified size.
digits() double?

Available on String, provided by the StringExtension extension

Returns double 0.564 from string percentage like "56.4%" Parse source as a double literal and return its value.
isValidFileExtension(String filename, {List<String>? allowed}) bool

Available on String, provided by the StringExtension extension

Returns true if string is a file
toCamelCase() String

Available on String, provided by the StringExtension extension

Converts a string from snake_case or kebab-case to camelCase.
toSnakeCase({String separator = '_'}) String

Available on String, provided by the StringExtension extension

Converts a string from camelCase to snake_case.