splitBefore method
Splits from a pattern
and returns String before that
Implementation
String splitBefore(Pattern pattern) {
ArgumentError.checkNotNull(pattern, 'pattern');
var matchIterator = pattern.allMatches(this.validate()).iterator;
Match? match;
while (matchIterator.moveNext()) {
match = matchIterator.current;
}
if (match != null) {
return this.validate().substring(0, match.start);
}
return '';
}