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 where substring occurs (non-overlapping). Audited: 2026-06-12 11:26 EDT
capitalizeSentences() → String

Available on String, provided by the StringMoreExtensions extension

Capitalizes the first letter after sentence boundaries (start or after . ). Audited: 2026-06-12 11:26 EDT
countOccurrences(String substring) → int

Available on String, provided by the StringMoreExtensions extension

Counts non-overlapping occurrences of substring in this string.
firstNWords(int n) → String

Available on String, provided by the StringMoreExtensions extension

Returns the first n words (split on whitespace). Returns empty string if n <= 0. Audited: 2026-06-12 11:26 EDT
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). Audited: 2026-06-12 11:26 EDT
joinLines([String separator = '\n']) → String

Available on String, provided by the StringMoreExtensions extension

Joins lines (split by newline) with separator. Default separator is newline (no-op). Audited: 2026-06-12 11:26 EDT
lastNWords(int n) → String

Available on String, provided by the StringMoreExtensions extension

Returns the last n words (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 to width with padChar, on the left if padLeft else right. Audited: 2026-06-12 11:26 EDT
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). Audited: 2026-06-12 11:26 EDT
stripHtmlComments() → String

Available on String, provided by the StringMoreExtensions extension

Removes HTML comments () from this string. Audited: 2026-06-12 11:26 EDT
stripSubstring(String substring) → String

Available on String, provided by the StringMoreExtensions extension

Removes leading and trailing occurrences of substring until none remain. Audited: 2026-06-12 11:26 EDT
swapCase() → String

Available on String, provided by the StringMoreExtensions extension

Swaps upper-case and lower-case for each character. Audited: 2026-06-12 11:26 EDT
wrapAtChars(int width) → String

Available on String, provided by the StringMoreExtensions extension

Wraps this string at width character boundaries (grapheme-safe). Returns chunks joined by newline. Audited: 2026-06-12 11:26 EDT