string_util library
Helper functions to performantly transform strings, without RegExp.
Functions
-
stripRegexStraySlashes(
String str) → String -
Removes the leading and trailing escaped slashes (
\/) ofstr. -
stripStray(
String haystack, String needle) → String -
Removes every leading and trailing occurrence of
needlefromhaystack, ashaystack.replaceAll(RegExp('^($needle)+|($needle)+\$'), '')does withneedleescaped, but without aRegExp. -
stripStraySlashes(
String str) → String -
Removes the leading and trailing slashes of
str, asstr.replaceAll(RegExp(r'(^/+)|(/+$)'), '')does, but about 40 times faster. Only slashes gives''.