I'm trying to split a string like the one : "@WWP2-@POLUXDATAWWP3-TTTTTW@K826" to extract the @WWP2-@POLUXDATAWWP3-TTTTTW and the 826 strings when executing the snippet :
String expression = "@WWP2-@POLUXDATAWWP3-TTTTTW@K826";
StringTokenizer tokenizer = new StringTokenizer(expression, "@K");
if (tokenizer.countTokens() > 0) {
while (tokenizer.hasMoreTokens()) {
System.out.println(tokenizer.nextToken());
}
}
while expecting the result to be
WWP2-POLUXDATAWWP3-TTTTTW
826
I'm getting:
WWP2-
POLUXDATAWWP3-TTTTTW
826
Any idea on how to get the exact two strings?