Java Char Array Value Check charArrayIsDigit(char[] str, int start, int len)

Here you can find the source of charArrayIsDigit(char[] str, int start, int len)

Description

char Array Is Digit

License

Apache License

Declaration

public static int charArrayIsDigit(char[] str, int start, int len) 

Method Source Code

//package com.java2s;

public class Main {

    public static int charArrayIsDigit(char[] str, int start, int len) {
        int value = 0;
        for (int i = start; i < start + len; i++) {
            char ch = str[i];
            if (ch >= '0' && ch <= '9') {
                value++;//from   w  w  w  .java  2  s  .co m
            } else {
                return value;
            }
        }
        return value;
    }
}