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 withvalueappended, or an empty string if this string is empty. -
getEverythingAfter(
String find) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns the substringSafe after the first occurrence offind. Returns the original string iffindis not found. -
getEverythingAfterLast(
String find) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns the substringSafe after the last occurrence offind. Returns the original string iffindis not found. -
getEverythingBefore(
String find) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns the substring before the first occurrence offind. -
getRandomChar(
) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a random character from this string. -
insert(
String newChar, int position) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string withnewCharinserted at the specifiedposition. -
isBracketWrapped(
) → bool -
Available on String, provided by the StringManipulationExtensions extension
Returnstrueif this string starts and ends with a matching bracket pair: parentheses, square brackets, curly braces, or angle brackets. -
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. -
normalizeApostrophe(
) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with apostrophe variants replaced by a standard single quote. -
prefixNotEmpty(
String? value) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns this string withvalueprepended, or this string unchanged if empty. -
removeAll(
Pattern? pattern) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with all occurrences ofpatternremoved. -
removeEnd(
String end) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string withendremoved from the end, if it exists. -
removeFirstChar(
) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with the first character removed. -
removeFirstLastChar(
) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with both the first and last characters removed. -
removeLastChar(
) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with the last character removed. -
removeLastOccurrence(
String target) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with the last occurrence oftargetremoved. -
removeLeadingAndTrailing(
String? find, {bool trim = false}) → String? -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with leading and trailing occurrences offindremoved, ornullif 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. -
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. -
removeStart(
String? start, {bool isCaseSensitive = true, bool trimFirst = false}) → String? -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string withstartremoved from the beginning, ornullif the result is empty. -
removeWrappingChar(
String char, {bool trimFirst = true}) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string withcharremoved from the beginning and/or end. -
repeat(
int count) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns this string repeatedcounttimes. -
replaceLastNCharacters(
int n, String replacementChar) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with the lastncharacters replaced byreplacementChar. -
replaceLineBreaks(
String? replacement, {bool deduplicate = true}) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with all line breaks replaced byreplacement. -
replaceNonNumbers(
{String replacement = ''}) → String -
Available on String, provided by the StringManipulationExtensions extension
Replaces all characters that are not digits (0-9) with thereplacementstring. -
toAlphaOnly(
{bool allowSpace = false}) → String -
Available on String, provided by the StringManipulationExtensions extension
Returns a new string with all non-letter characters removed.