removeFirstAny method
Continuously removes from the beginning of the String
any match in patterns
.
Example
String s = "esentis".removeFirstAny(["s", "ng"]);// returns "esentis";
Implementation
String removeFirstAny(List<String?> patterns) {
var from = this;
if (from.isNotBlank) {
for (var pattern in patterns) {
if (pattern != null && pattern.isNotEmpty) {
while (from.startsWith(pattern)) {
from = from.removeFirst(pattern.length);
}
}
}
}
return from;
}