DHUStringExtensions extension
Extensions for common String helpers.
- on
Properties
- clean → String
-
Available on String, provided by the DHUStringExtensions extension
Removes all whitespace characters and collapses the string into a single line. Example: "Line 1\n Line 2" => "Line1Line2"no setter -
lines
→ List<
String> -
Available on String, provided by the DHUStringExtensions extension
Splits the string into a list of lines.no setter - nullIfBlank → String?
-
Available on String, provided by the DHUStringExtensions extension
If the string is blank (null, empty, or consists only of whitespace), return null. Otherwise, return the string. Alias for isEmptyOrNull.no setter - nullIfEmpty → String?
-
Available on String, provided by the DHUStringExtensions extension
If the string is empty, return null. Otherwise, return the string.no setter - removeEmptyLines → String
-
Available on String, provided by the DHUStringExtensions extension
Removes consecutive empty lines, replacing them with single newlines. Example: "Line1\n\n\nLine2" => "Line1\nLine2"no setter - removeWhiteSpaces → String
-
Available on String, provided by the DHUStringExtensions extension
Removes all whitespace characters (spaces, tabs, newlines, etc.) from the string. Example: "Line 1\tLine 2" => "Line1Line2"no setter - toOneLine → String
-
Available on String, provided by the DHUStringExtensions extension
Converts the string into a single line by replacing newline characters. Example: "Line1\nLine2" => "Line1Line2"no setter -
words
→ List<
String> -
Available on String, provided by the DHUStringExtensions extension
Splits the string into a list of words.no setter
Methods
-
base64Decode(
{bool? allowMalformed}) → String -
Available on String, provided by the DHUStringExtensions extension
Base64 Decode -
base64Encode(
) → String -
Available on String, provided by the DHUStringExtensions extension
Base64 Encode for this String -
normalizeWhitespace(
) → String -
Available on String, provided by the DHUStringExtensions extension
Collapses consecutive whitespace into single spaces and trims the result. -
parseDuration(
) → Duration -
Available on String, provided by the DHUStringExtensions extension
Parses this string into a Duration. -
slugify(
{String separator = '-'}) → String -
Available on String, provided by the DHUStringExtensions extension
Converts the string to a URL/filename-friendly slug.