QStringExtensions extension

String extensions for QUtils

Provides convenient extension methods on String objects for type conversion, JSON operations, and utility functions.

on

Properties

directoryPath String?

Available on String, provided by the QStringExtensions extension

Gets the directory path from this file path
no setter
fileExtension String?

Available on String, provided by the QStringExtensions extension

Gets the file extension from this file path
no setter
isEmail bool

Available on String, provided by the QStringExtensions extension

Checks if this string is a valid email address
no setter
isNullOrEmpty bool

Available on String, provided by the QStringExtensions extension

Checks if this string is null or empty
no setter
isNullOrWhitespace bool

Available on String, provided by the QStringExtensions extension

Checks if this string is null, empty, or contains only whitespace
no setter
isNumber bool

Available on String, provided by the QStringExtensions extension

Checks if this string is a valid number (int or double)
no setter
isNumeric bool

Available on String, provided by the QStringExtensions extension

Checks if this string contains only digits
no setter
isURL bool

Available on String, provided by the QStringExtensions extension

Checks if this string is a valid URL
no setter
isValidJSON bool

Available on String, provided by the QStringExtensions extension

Checks if this string is valid JSON
no setter
wordCount int

Available on String, provided by the QStringExtensions extension

Counts the number of words in this string
no setter

Methods

alphanumericOnly({bool keepSpaces = false}) String

Available on String, provided by the QStringExtensions extension

Removes all non-alphanumeric characters from this string
asBoolSafe([bool? fallback]) bool?

Available on String, provided by the QStringExtensions extension

Safely converts this string to a boolean
asDateTimeSafe({List<String>? customFormats, DateTime? fallback}) DateTime?

Available on String, provided by the QStringExtensions extension

Safely converts this string to a DateTime
asDoubleSafe([double? fallback]) double?

Available on String, provided by the QStringExtensions extension

Safely converts this string to a double
asIntSafe([int? fallback]) int?

Available on String, provided by the QStringExtensions extension

Safely converts this string to an integer
asListFromJSON([List? fallback]) List?

Available on String, provided by the QStringExtensions extension

Safely parses this JSON string to a List
asListSafe<T>({String delimiter = ',', List<T>? fallback}) List<T>?

Available on String, provided by the QStringExtensions extension

Safely converts this string to a List by splitting
asMapFromJSON([Map<String, dynamic>? fallback]) Map<String, dynamic>?

Available on String, provided by the QStringExtensions extension

Safely parses this JSON string to a Map
asNumSafe([num? fallback]) num?

Available on String, provided by the QStringExtensions extension

Safely converts this string to a num
capitalize() String

Available on String, provided by the QStringExtensions extension

Capitalizes the first letter of this string
capitalizeWords() String

Available on String, provided by the QStringExtensions extension

Capitalizes the first letter of each word in this string
hasValidFileExtension(List<String> validExtensions) bool

Available on String, provided by the QStringExtensions extension

Checks if this file path has a valid extension from the given list
jsonExtract(String path, [dynamic fallback]) → dynamic

Available on String, provided by the QStringExtensions extension

Extracts a value from this JSON string using dot notation path
jsonHumanSize({int decimals = 2}) String?

Available on String, provided by the QStringExtensions extension

Gets human-readable size of this JSON string
jsonKeyCount({bool recursive = true}) int?

Available on String, provided by the QStringExtensions extension

Counts the number of keys in this JSON object
jsonMinify() String?

Available on String, provided by the QStringExtensions extension

Minifies this JSON string by removing whitespace
jsonPrettify({String indent = ' '}) String?

Available on String, provided by the QStringExtensions extension

Prettifies this JSON string with proper indentation
jsonSize() int?

Available on String, provided by the QStringExtensions extension

Gets the size of this JSON string in bytes
jsonValidate() JSONValidationResult

Available on String, provided by the QStringExtensions extension

Validates if this string is valid JSON
reverse() String

Available on String, provided by the QStringExtensions extension

Reverses this string
toCamelCase() String

Available on String, provided by the QStringExtensions extension

Converts this string to camelCase
toKebabCase() String

Available on String, provided by the QStringExtensions extension

Converts this string to kebab-case
toPascalCase() String

Available on String, provided by the QStringExtensions extension

Converts this string to PascalCase
toReadableString() String

Available on String, provided by the QStringExtensions extension

Formats this string as readable string (returns this string)
toSnakeCase() String

Available on String, provided by the QStringExtensions extension

Converts this string to snake_case
truncate(int maxLength, {String ellipsis = '...'}) String

Available on String, provided by the QStringExtensions extension

Truncates this string to the specified length and adds ellipsis