StringManipulationExtensions extension

Extensions on String for character manipulation, removal, and cleaning.

on

Methods

appendNotEmpty(String value) String

Available on String, provided by the StringManipulationExtensions extension

Returns this string with value appended, or an empty string if this string is empty. Audited: 2026-06-12 11:26 EDT
getEverythingAfter(String find) String

Available on String, provided by the StringManipulationExtensions extension

Returns the substringSafe after the first occurrence of find. Returns the original string if find is not found. Audited: 2026-06-12 11:26 EDT
getEverythingAfterLast(String find) String

Available on String, provided by the StringManipulationExtensions extension

Returns the substringSafe after the last occurrence of find. Returns the original string if find is not found. Audited: 2026-06-12 11:26 EDT
getEverythingBefore(String find) String

Available on String, provided by the StringManipulationExtensions extension

Returns the substring before the first occurrence of find.
getRandomChar() String

Available on String, provided by the StringManipulationExtensions extension

Returns a random character from this string. Audited: 2026-06-12 11:26 EDT
insert(String newChar, int position) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with newChar inserted at the specified position.
isBracketWrapped() bool

Available on String, provided by the StringManipulationExtensions extension

Returns true if this string starts and ends with a matching bracket pair: parentheses, square brackets, curly braces, or angle brackets. Audited: 2026-06-12 11:26 EDT
lettersOnly() String

Available on String, provided by the StringManipulationExtensions extension

Extracts only ASCII letter characters (A-Z, a-z) from this string.
lowerCaseLettersOnly() String

Available on String, provided by the StringManipulationExtensions extension

Extracts only ASCII lowercase letter characters (a-z) from this string.
makeNonBreaking() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with hyphens and spaces replaced by non-breaking equivalents. Audited: 2026-06-12 11:26 EDT
normalizeApostrophe() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with apostrophe variants replaced by a standard single quote. Audited: 2026-06-12 11:26 EDT
prefixNotEmpty(String? value) String

Available on String, provided by the StringManipulationExtensions extension

Returns this string with value prepended, or this string unchanged if empty. Audited: 2026-06-12 11:26 EDT
removeAll(Pattern? pattern) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with all occurrences of pattern removed. Audited: 2026-06-12 11:26 EDT
removeEnd(String end) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with end removed from the end, if it exists.
removeEndNullable(String? find) String?

Available on String, provided by the StringManipulationExtensions extension

Removes find from the end of this string, tolerating a null/empty find, and signals "no source to strip from" with null.
removeFirstChar() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the first character removed. Audited: 2026-06-12 11:26 EDT
removeFirstLastChar() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with both the first and last characters removed. Audited: 2026-06-12 11:26 EDT
removeLastChar() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the last grapheme cluster removed.
removeLastChars(int count) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the last count grapheme clusters removed.
removeLastOccurrence(String target) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the last occurrence of target removed. Audited: 2026-06-12 11:26 EDT
removeLeadingAndTrailing(String? find, {bool trim = false}) String?

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with leading and trailing occurrences of find removed, or null if the result is empty.
removeMatchingWrappingBrackets() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the outer matching bracket pair removed. Audited: 2026-06-12 11:26 EDT
removeNonAlphaNumeric({bool allowSpace = false}) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with all non-alphanumeric characters removed.
removeNonNumbers() String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with all non-digit characters removed. Audited: 2026-06-12 11:26 EDT
removeStart(String? start, {bool isCaseSensitive = true, bool trimFirst = false}) String?

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with start removed from the beginning, or null if the result is empty.
removeWrappingChar(String char, {bool trimFirst = true}) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with char removed from the beginning and/or end.
repeat(int count) String

Available on String, provided by the StringManipulationExtensions extension

Returns this string repeated count times.
replaceLastNCharacters(int n, String replacementChar) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with the last n characters replaced by replacementChar. Audited: 2026-06-12 11:26 EDT
replaceLineBreaks(String? replacement, {bool deduplicate = true}) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with all line breaks replaced by replacement.
replaceNonNumbers({String replacement = ''}) String

Available on String, provided by the StringManipulationExtensions extension

Replaces all characters that are not digits (0-9) with the replacement string.
toAlphaOnly({bool allowSpace = false}) String

Available on String, provided by the StringManipulationExtensions extension

Returns a new string with all non-letter characters removed.