测试是否以数字开头,负数也是数字,但是不支持科学表达式模型

@return if matches a digit character
930
public boolean matchesDigit() {
        return !isEmpty() && (Character.isDigit(queue.charAt(pos))
                || queue.charAt(pos) == '-' && remainingLength() >= 2 && Character.isDigit(queue.charAt(pos + 1)));
    }
297643
public String getDecimalPart(final int digit) {
        
        final int length = decimalPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return String.valueOf(decimalPart.charAt(digit-1));
        
    }
232898
@Override
    protected boolean isTokenChar(int c) {

      if(!Character.isWhitespace(c) && searchCharacters.indexOf(c) == -1){
        return true;
      }
      return false;
    }
94206
private static boolean match(char c, long lowMask, long highMask) {
        if (c < 64)
            return ((1L << c) & lowMask) != 0;
        if (c < 128)
            return ((1L << (c - 64)) & highMask) != 0;
        return false;
    }
491460
private boolean checkNlTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(8) - '0';
    int sum = 0;
    for (int i = 0; i < ptaxNumber.length() - 1; i++) {
      sum += (ptaxNumber.charAt(i) - '0') * (9 - i);
    }
    sum -= checkSum;
    return sum % 11 == 0;
  }
1134369
private String digit(Data data) {
	String rtn = "";
	while (data.srcCode.isValidIndex()) {
	    if (!data.srcCode.isCurrentBetween('0', '9')) break;
	    rtn += data.srcCode.getCurrentLower();
	    data.srcCode.next();
	}
	return rtn;
    }
796890
public static boolean hasDigit(String str)
  {
    final Pattern pattern = Pattern.compile("[0-9]");
    final Matcher matcher = pattern.matcher(str);
    while (matcher.find())
    {
      return true;
    }
    return false;
  }
1253114
public static boolean isDigitsOnly(String s) {
        if (isEmpty(s)) return false;
        String rslt = s.trim();
        if (isEmpty(rslt)) return false;
        for (int i = 0; i < rslt.length(); i++) {
            char ch = rslt.charAt(i);
            if (!Character.isDigit(ch)) return false;
        }
        return true;
    }
800545
static boolean containsNoDigit(final String s) {
    for (int k = 0; k < s.length(); k++) {
      if (Character.isDigit(s.charAt(k))) {
        return false;
      }
    }
    return true;
  }
1047785
public static boolean isNumeric(String string)
  {
    if(string == null || string.isEmpty()) return false;

    State state = State.SIGN;
    for(int i = 0; i < string.length(); ++i) {
      char c = string.charAt(i);

      switch(state) {
      case SIGN:
        if(c == '-' || c == '+') {
          state = State.INTEGER;
          break;
        }
        if(c == DECIMAL_SEPARATOR) {
          state = State.FRACTIONAL;
          break;
        }
        if(Character.isDigit(c)) {
          state = State.INTEGER;
          break;
        }
        return false;

      case INTEGER:
        if(Character.isDigit(c)) {
          break;
        }
        if(c == GROUPING_SEPARATOR) {
          break;
        }
        if(c == DECIMAL_SEPARATOR) {
          state = State.FRACTIONAL;
          break;
        }
        if(c == 'e' || c == 'E') {
          state = State.EXPONENT_SIGN;
          break;
        }
        if(isNumericSuffix(c)) {
          state = State.END;
          break;
        }
        return false;

      case FRACTIONAL:
        if(c == 'e' || c == 'E') {
          state = State.EXPONENT_SIGN;
          break;
        }
        if(isNumericSuffix(c)) {
          state = State.END;
          break;
        }
        if(Character.isDigit(c)) {
          break;
        }
        return false;

      case EXPONENT_SIGN:
        if(c == '-' || c == '+') {
          state = State.EXPONENT;
          break;
        }
        if(Character.isDigit(c)) {
          break;
        }
        return false;

      case EXPONENT:
        if(isNumericSuffix(c)) {
          state = State.END;
          break;
        }
        if(Character.isDigit(c)) {
          break;
        }
        return false;

      case END:
        return false;

      default:
        throw new IllegalStateException();
      }

    }
    return true;
  }
1345455
function isPercentDigitDigit (text, start) {
        return text.charAt(start) === '%' && charHelper.isHexDigit(text.charAt(start + 1)) && charHelper.isHexDigit(text.charAt(start + 2));
    }
983724
@Override
    CharsetMatch match(CharsetDetector det) {
        boolean     hasBOM = false;
        int         numValid = 0;
        int         numInvalid = 0;
        byte        input[] = det.fRawInput;
        int         i;
        int         trailBytes = 0;
        int         confidence;

        if (det.fRawLength >= 3 &&
                (input[0] & 0xFF) == 0xef && (input[1] & 0xFF) == 0xbb && (input[2] & 0xFF) == 0xbf) {
            hasBOM = true;
        }

        // Scan for multi-byte sequences
        for (i=0; i<det.fRawLength; i++) {
            int b = input[i];
            if ((b & 0x80) == 0) {
                continue;   // ASCII
            }

            // Hi bit on char found.  Figure out how long the sequence should be
            if ((b & 0x0e0) == 0x0c0) {
                trailBytes = 1;
            } else if ((b & 0x0f0) == 0x0e0) {
                trailBytes = 2;
            } else if ((b & 0x0f8) == 0xf0) {
                trailBytes = 3;
            } else {
                numInvalid++;
                continue;
            }

            // Verify that we've got the right number of trail bytes in the sequence
            for (;;) {
                i++;
                if (i>=det.fRawLength) {
                    break;
                }
                b = input[i];
                if ((b & 0xc0) != 0x080) {
                    numInvalid++;
                    break;
                }
                if (--trailBytes == 0) {
                    numValid++;
                    break;
                }
            }
        }

        // Cook up some sort of confidence score, based on presense of a BOM
        //    and the existence of valid and/or invalid multi-byte sequences.
        confidence = 0;
        if (hasBOM && numInvalid==0) {
            confidence = 100;
        } else if (hasBOM && numValid > numInvalid*10) {
            confidence = 80;
        } else if (numValid > 3 && numInvalid == 0) {
            confidence = 100;
        } else if (numValid > 0 && numInvalid == 0) {
            confidence = 80;
        } else if (numValid == 0 && numInvalid == 0) {
            // Plain ASCII. Confidence must be > 10, it's more likely than UTF-16, which
            //              accepts ASCII with confidence = 10.
            // TODO: add plain ASCII as an explicitly detected type.
            confidence = 15;
        } else if (numValid > numInvalid*10) {
            // Probably corruput utf-8 data.  Valid sequences aren't likely by chance.
            confidence = 25;
        }
        return confidence == 0 ? null : new CharsetMatch(det, this, confidence);
    }
1232193
private boolean checkPlTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0';
    int calculatedCheckSum;
    if (StringUtils.length(ptaxNumber) == 11) {
      // PESEL
      final int sum = (ptaxNumber.charAt(0) - '0') * 1 //
          + (ptaxNumber.charAt(1) - '0') * 3 //
          + (ptaxNumber.charAt(2) - '0') * 7 //
          + (ptaxNumber.charAt(3) - '0') * 9 //
          + (ptaxNumber.charAt(4) - '0') * 1 //
          + (ptaxNumber.charAt(5) - '0') * 3 //
          + (ptaxNumber.charAt(6) - '0') * 7 //
          + (ptaxNumber.charAt(7) - '0') * 9 //
          + (ptaxNumber.charAt(8) - '0') * 1 //
          + (ptaxNumber.charAt(9) - '0') * 3;
      calculatedCheckSum = sum % 10;
      if (calculatedCheckSum != 0) {
        calculatedCheckSum = 10 - sum % 10;
      }
    } else {
      // NIP
      final int sum = (ptaxNumber.charAt(0) - '0') * 6 //
          + (ptaxNumber.charAt(1) - '0') * 5 //
          + (ptaxNumber.charAt(2) - '0') * 7 //
          + (ptaxNumber.charAt(3) - '0') * 2 //
          + (ptaxNumber.charAt(4) - '0') * 3 //
          + (ptaxNumber.charAt(5) - '0') * 4 //
          + (ptaxNumber.charAt(6) - '0') * 5 //
          + (ptaxNumber.charAt(7) - '0') * 6 //
          + (ptaxNumber.charAt(8) - '0') * 7;
      calculatedCheckSum = sum % MODULO_11;
    }
    return checkSum == calculatedCheckSum;
  }
396346
private boolean checkEeTin(final String ptin) {
    final int checkSum = ptin.charAt(10) - '0';
    int calculatedCheckSum = ((ptin.charAt(0) - '0') * 1 //
        + (ptin.charAt(1) - '0') * 2 //
        + (ptin.charAt(2) - '0') * 3 //
        + (ptin.charAt(3) - '0') * 4 //
        + (ptin.charAt(4) - '0') * 5 //
        + (ptin.charAt(5) - '0') * 6 //
        + (ptin.charAt(6) - '0') * 7 //
        + (ptin.charAt(7) - '0') * 8 //
        + (ptin.charAt(8) - '0') * 9 //
        + (ptin.charAt(9) - '0') * 1) //
        % MODULO_11;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = ((ptin.charAt(0) - '0') * 3 //
          + (ptin.charAt(1) - '0') * 4 //
          + (ptin.charAt(2) - '0') * 5 //
          + (ptin.charAt(3) - '0') * 6 //
          + (ptin.charAt(4) - '0') * 7 //
          + (ptin.charAt(5) - '0') * 8 //
          + (ptin.charAt(6) - '0') * 9 //
          + (ptin.charAt(7) - '0') * 1 //
          + (ptin.charAt(8) - '0') * 2 //
          + (ptin.charAt(9) - '0') * 3) //
          % MODULO_11 % 10;
    }
    return checkSum == calculatedCheckSum;
  }
1366432
private boolean match(String keyword, int fromIndex) {

        int match = 0;

        // 查找非空白字符。
        for (int index = fromIndex; index < length; index++) {

            char ch = pattern.charAt(index);

            if (!Character.isWhitespace(ch)) {
                match = index;
                break;
            }
        }

        // 匹配关键字内容。
        for (int index = 0; index < keyword.length(); index++) {

            char ch = pattern.charAt(match);

            if (ch != keyword.charAt(index)) {
                // 与关键字不匹配
                return false;
            }

            match++;
        }

        // 修改当前位置
        position = match;

        return true;
    }
697491
public static boolean allDigits(String string) {
        if (string == null || string.length() == 0) {
            return false;
        }
        for (int index = 0; index < string.length(); index++) {
            char ch = string.charAt(index);
            if (ch < '0' || ch > '9') {
                return false;
            }
        }
        return true;
    }
494138
public static boolean isDigit(int ch)
   {
      return (0x0030 <= ch && ch <= 0x0039) || (0x0660 <= ch && ch <= 0x0669) || (0x06F0 <= ch && ch <= 0x06F9)
         || (0x0966 <= ch && ch <= 0x096F) || (0x09E6 <= ch && ch <= 0x09EF) || (0x0A66 <= ch && ch <= 0x0A6F)
         || (0x0AE6 <= ch && ch <= 0x0AEF) || (0x0B66 <= ch && ch <= 0x0B6F) || (0x0BE7 <= ch && ch <= 0x0BEF)
         || (0x0C66 <= ch && ch <= 0x0C6F) || (0x0CE6 <= ch && ch <= 0x0CEF) || (0x0D66 <= ch && ch <= 0x0D6F)
         || (0x0E50 <= ch && ch <= 0x0E59) || (0x0ED0 <= ch && ch <= 0x0ED9) || (0x0F20 <= ch && ch <= 0x0F29);
   }