// Demonstrate StringTokenizer.
import java.util.StringTokenizer;
class STDemo {
static String in = "title=Java-Samples;" +
"author=Emiley J;" +
"publisher=java-samples.com;" +
"copyright=2007;";
public static void main(String args[]) {
StringTokenizer st = new StringTokenizer(in, "=;");
while(st.hasMoreTokens()) {
String key = st.nextToken();
String val = st.nextToken();
System.out.println(key + "\t" + val);
}
}
}
import java.util.StringTokenizer;
class STDemo {
static String in = "title=Java-Samples;" +
"author=Emiley J;" +
"publisher=java-samples.com;" +
"copyright=2007;";
public static void main(String args[]) {
StringTokenizer st = new StringTokenizer(in, "=;");
while(st.hasMoreTokens()) {
String key = st.nextToken();
String val = st.nextToken();
System.out.println(key + "\t" + val);
}
}
}
0 comments:
Post a Comment