I need to check if a string contains any symbols other than a space. I cant check with
String.length() > 0
or
String.equals("")
since spaces are considered as characters. How can I find out whether a java String contains other characters (letters, symbols, numbers, whatever) ?
You can use
If String only contains spaces they all will be removed by
trim()before checking for equality