timesString method

  1. @useResult
Parser<String> timesString(
  1. int count, [
  2. String? message
])

Returns a parser that accepts the receiver exactly count times. The resulting parser returns the consumed input string.

This implementation is equivalent to PossessiveRepeatingParserExtension.times, but particularly performant when used on character parsers. Instead of a List it returns the parsed sub-String.

For example, the parser letter().timesString(2) accepts two letters and returns a string of the two parsed letters.

Implementation

@useResult
Parser<String> timesString(int count, [String? message]) =>
    repeatString(count, count, message);