StringExt extension

Extension on String to add conversion, formatting, and utility methods.

on

Properties

toDouble double

Available on String, provided by the StringExt extension

Parses the string to a double. Returns 0.0 if parsing fails.
no setter
toInt int

Available on String, provided by the StringExt extension

Parses the string to an int. Returns 0 if parsing fails.
no setter

Methods

calculateReadingTime() int

Available on String, provided by the StringExt extension

Estimates the reading time of the text in minutes.
toDuration() Duration

Available on String, provided by the StringExt extension

Parses a time string (e.g. "MM:SS" or "HH:MM:SS") into a Duration.
toSentenceCase() String

Available on String, provided by the StringExt extension

Capitalizes the first character of the string, leaving the rest as-is.
toTitleCase() String

Available on String, provided by the StringExt extension

Capitalizes the first letter of each word in the string.