determineConsecutiveDigitCount static method

int determineConsecutiveDigitCount(
  1. String msg,
  2. int startPos
)

Determines the number of consecutive characters that are encodable using numeric compaction.

@param msg the message @param startPos the start position within the message @return the requested character count

Implementation

static int determineConsecutiveDigitCount(String msg, int startPos) {
  final len = msg.length;
  int idx = startPos;
  while (idx < len && isDigit(msg.codeUnitAt(idx))) {
    idx++;
  }
  return idx - startPos;
}