If your numbers are separated by commas, first wrap the String;
tok = new StringTokenizer(string, ",");
then try to create a number from each token. If this is not a number, then this is a symbol:
while (tok.hasMoreTokens()){
String tok = tok.nextTok();
try {
new Integer(tok);
}catch (NumberFormatException e){
}
}
If tok is not a number, a NumberFormatException is thrown.
source
share