简体   繁体   中英

Check if String array of digits contains symbol

Got String[][] arr which contains only digit in String format.

 if (array[i][j].equals("[a-zA-Z]+")){ - not help

How to check if this arr contains symbol ?

 mystring.matches("\\d+");

Returns true when all the chars are digits. This won't break even if the number is greater than the limit of int .

You can see some other examples here

Determine if a String is an Integer in Java

You can check each cell in the array for its ascii value.

for exampe: if its between 65-90 its a capital letter

http://www.asciitable.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM