StringExtensions extension
adds utility methods to String
- on
Methods
-
endsWithPattern(
Pattern exp) → bool -
Available on String, provided by the StringExtensions extension
checks if string ends with pattern -
normalizeLineBreaks(
) → String -
Available on String, provided by the StringExtensions extension
replaces all windows (CRLF) and old mac (CR) line breaks with normal (LF) -
replaceLast(
Pattern from, String to) → String -
Available on String, provided by the StringExtensions extension
replaces the last occurence of Pattern on the string -
replaceLineBreaks(
[String replacement = '']) → String -
Available on String, provided by the StringExtensions extension
replaces line endings with support for windows non-sense \r\n defaults to replacing with empty string -
toBigInt(
[int? radix]) → BigInt -
Available on String, provided by the StringExtensions extension
converts to BigInt based on the givenradix -
toDate(
) → DateTime -
Available on String, provided by the StringExtensions extension
converts to DateTime without time component -
toDateTime(
) → DateTime -
Available on String, provided by the StringExtensions extension
converts to DateTime -
toDouble(
) → double -
Available on String, provided by the StringExtensions extension
converts to double -
toInt(
) → int -
Available on String, provided by the StringExtensions extension
converts to int -
toNum(
) → num -
Available on String, provided by the StringExtensions extension
converts to num. Uses tryToNum and ultimately throws error from num.parse if invalid -
toSentenceCase(
) → String -
Available on String, provided by the StringExtensions extension
naive implementation of sentence case, not using locale; this works for english, but has no guarantees for other languages -
toTitleCase(
) → String -
Available on String, provided by the StringExtensions extension
naive implementation of title case, not using locale; this works for english, but has no guarantees for other languages -
trimInvisible(
) → String -
Available on String, provided by the StringExtensions extension
trims all invisible spaces as defined in string.invisibleWhitespace -
trimPattern(
Pattern pattern) → String -
Available on String, provided by the StringExtensions extension
trims Pattern on the string -
trimPatternLeft(
Pattern pattern) → String -
Available on String, provided by the StringExtensions extension
trims Pattern on the start of the string -
trimPatternRight(
Pattern pattern) → String -
Available on String, provided by the StringExtensions extension
trims Pattern on the end of the string -
tryToBigInt(
[int? radix]) → BigInt? -
Available on String, provided by the StringExtensions extension
tries to convert String to BigInt based on givenradix -
tryToDate(
) → DateTime? -
Available on String, provided by the StringExtensions extension
converts to DateTime without time component -
tryToDateTime(
) → DateTime? -
Available on String, provided by the StringExtensions extension
tries to convert string to DateTime -
tryToDouble(
) → double? -
Available on String, provided by the StringExtensions extension
tries to convert string to double -
tryToInt(
) → int? -
Available on String, provided by the StringExtensions extension
tries to convert string to int -
tryToNum(
) → num? -
Available on String, provided by the StringExtensions extension
tries to convert string to num