一、StringTokenizer,例子以下:java
class StringToken
{
static String str = "1:java;"+"2:perl;"+"3:C/C++;"+"4:shell;";
public static void main(String [] args)
{
StringTokenizer ST = new StringTokenizer(str,":;");//以:;爲分隔符
while(ST.hasMoreTokens()){
String key = ST.nextToken();
String value = ST.nextToken();
System.out.println(key+":"+value);
}