StringMoreExtensions extension
String More: strip leading/trailing substring, join lines, wrap at N, capitalize sentence, swap case, etc. Roadmap #251-265.
- on
Methods
-
allIndicesOf(
String substring) → List< int> -
Available on String, provided by the StringMoreExtensions extension
Returns all start indices wheresubstringoccurs (non-overlapping). -
capitalizeSentences(
) → String -
Available on String, provided by the StringMoreExtensions extension
Capitalizes the first letter after sentence boundaries (start or after.). -
countOccurrences(
String substring) → int -
Available on String, provided by the StringMoreExtensions extension
Counts non-overlapping occurrences ofsubstringin this string. -
firstNWords(
int n) → String -
Available on String, provided by the StringMoreExtensions extension
Returns the firstnwords (split on whitespace). Returns empty string if n <= 0. -
isPalindrome(
{bool ignoreCase = true, bool ignorePunctuation = false}) → bool -
Available on String, provided by the StringMoreExtensions extension
Returns true if this string reads the same forwards and backwards (optionally ignoring case/punctuation). -
joinLines(
[String separator = '\n']) → String -
Available on String, provided by the StringMoreExtensions extension
Joins lines (split by newline) withseparator. Default separator is newline (no-op). -
lastNWords(
int n) → String -
Available on String, provided by the StringMoreExtensions extension
Returns the lastnwords (split on whitespace), preserving their order. -
padToWidth(
int width, {bool padLeft = true, String padChar = ' '}) → String -
Available on String, provided by the StringMoreExtensions extension
Pads this string towidthwithpadChar, on the left ifpadLeftelse right. -
removeRepeatedChars(
) → String -
Available on String, provided by the StringMoreExtensions extension
Collapses runs of the same character into one, keeping order. -
reverseWords(
) → String -
Available on String, provided by the StringMoreExtensions extension
Reverses the order of words (split on whitespace). -
stripHtmlComments(
) → String -
Available on String, provided by the StringMoreExtensions extension
Removes HTML comments () from this string. -
stripSubstring(
String substring) → String -
Available on String, provided by the StringMoreExtensions extension
Removes leading and trailing occurrences ofsubstringuntil none remain. -
swapCase(
) → String -
Available on String, provided by the StringMoreExtensions extension
Swaps upper-case and lower-case for each character. -
wrapAtChars(
int width) → String -
Available on String, provided by the StringMoreExtensions extension
Wraps this string atwidthcharacter boundaries (grapheme-safe). Returns chunks joined by newline.