A StringTokenizer
splits the string at each position of all supplied characters in the delimiter argument. It does not split at the occurrence of the whole supplied string. Besides, it is a legacy class and its usage in new code is not recommended.
Use String#split
which takes a regular expression that is used to tokenise the string:
String output = "New Record created successfully<br>Enter stops<br>";
String[] tokens = output.split("<br>");
String token = tokens[0];
System.out.println(token);
if (tokens.length > 0) {
token = tokens[1];
System.out.println(token);
}
Output:
New Record created successfully
Enter stops
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…