lookAheadTest static method

int lookAheadTest(
  1. String msg,
  2. int startPos,
  3. int currentMode
)

Implementation

static int lookAheadTest(String msg, int startPos, int currentMode) {
  final newMode = lookAheadTestIntern(msg, startPos, currentMode);
  if (currentMode == x12Encodation && newMode == x12Encodation) {
    final endPos = math.min(startPos + 3, msg.length);
    for (int i = startPos; i < endPos; i++) {
      if (!isNativeX12(msg.codeUnitAt(i))) {
        return asciiEncodation;
      }
    }
  } else if (currentMode == edifactEncodation &&
      newMode == edifactEncodation) {
    final endPos = math.min(startPos + 4, msg.length);
    for (int i = startPos; i < endPos; i++) {
      if (!isNativeEDIFACT(msg.codeUnitAt(i))) {
        return asciiEncodation;
      }
    }
  }
  return newMode;
}