public static boolean isDecimal ( String str , int beginIndex , int endIndex ) { if ( str . charAt ( str . length ( ) - 1 ) == ' ' || str . charAt ( 0 ) == ' ' ) { return false ; } char c ; int p = 0 ; //number of point for ( int j = 1 ; j < str . length ( ) ; j ++ ) { c = str . charAt ( j ) ; if ( c == ' ' ) { p ++ ; } else { //make full-width half-width if ( c > 65280 ) c -= 65248 ; if ( c < 48 || c > 57 ) return false ; } } return ( p == 1 ) ; }
check the specified char is a decimal including the full - width char