stringIgnoreCase function
Returns a parser that accepts the string element
ignoring the case.
For example, stringIgnoreCase('foo')
succeeds and consumes the input
string 'Foo'
or 'FOO'
. Fails for any other input.
Implementation
@useResult
Parser<String> stringIgnoreCase(String element, [String? message]) {
final lowerElement = element.toLowerCase();
return predicate(element.length, (each) => lowerElement == each.toLowerCase(),
message ?? '"$element" (case-insensitive) expected');
}