StringExtensions extension
StringExtensions provides utility methods for String manipulation.
-
datetimeFormatter: Formats a date string into a specified format. It tries to parse the string as an ISO date first. If parsing fails and
currentDateFormatis provided, it attempts to parse using that format. Returns the formatted date string or an error message if parsing fails. Example: "2024-06-01".datetimeFormatter(format: "dd MMM yyyy") // "01 Jun 2024" -
toNum: Attempts to parse the string as a number (int or double). Returns the parsed number or null if parsing fails. Example: "123.45".toNum() // 123.45
- on
Methods
-
datetimeFormatter(
{String outputFormat = "dd/MM/yyyy", String? inputFormat}) → String -
Available on String, provided by the StringExtensions extension
-
toNum(
) → num? -
Available on String, provided by the StringExtensions extension