trimPatternLeft method
trims Pattern on the start of the string
Implementation
String trimPatternLeft(Pattern pattern) {
var res = this;
while (res.isNotEmpty && res._startsWithNonEmpty(pattern) != null) {
final newInput = res.replaceFirst(pattern, '');
if (newInput.length >= res.length) {
assert(
false,
'trimming $res on the left incorrectly resulted in $newInput\n',
);
return res;
}
res = newInput;
}
return res;
}