Java by API/java.lang/StringTokenizer
new StringTokenizer(String str, String delim)
/*
* Output:
*
a 1
b 2
*/
import java.util.StringTokenizer;
public class MainClass {
public static void main(String args[]) {
String in = "a=1;" + "b=2";
StringTokenizer st = new StringTokenizer(in, "=;");
while (st.hasMoreTokens()) {
String key = st.nextToken();
String val = st.nextToken();
System.out.println(key + "\t" + val);
}
}
}
StringTokenizer: hasMoreTokens()
/*
* Output:
*
a 1
b 2
*/
import java.util.StringTokenizer;
public class MainClass {
public static void main(String args[]) {
String in = "a=1;" + "b=2";
StringTokenizer st = new StringTokenizer(in, "=;");
while (st.hasMoreTokens()) {
String key = st.nextToken();
String val = st.nextToken();
System.out.println(key + "\t" + val);
}
}
}
StringTokenizer: nextToken()
/*
* Output:
*
a 1
b 2
*/
import java.util.StringTokenizer;
public class MainClass {
public static void main(String args[]) {
String in = "a=1;" + "b=2";
StringTokenizer st = new StringTokenizer(in, "=;");
while (st.hasMoreTokens()) {
String key = st.nextToken();
String val = st.nextToken();
System.out.println(key + "\t" + val);
}
}
}