How to check if String contains only operators?
code:
public void convertString(String s){
String[] arr = s.split("");
for (int i = 0; i < arr.length ; i++) {
stringStack.push(arr[i]);
}
if (stringStack.peek().matches("[0-9]+")){
digitStack.push(Double.valueOf(stringStack.pop()));
}else if (stringStack.peek().matches("[(+=-*/^)]+")){
}
System.out.println(digitStack);
}
in this line "[(+=-*/^)]+"
a receive error:
Illegal character range (to < from)
How to check if String
contains only operators?