StringTokenizer分割字符串

public static void main(String[] args) throws Exception {

 

String result = JOptionPane.showInputDialog("请输入用户名和密码,以','隔开!");

StringTokenizer st = new StringTokenizer(result, ",");

String user = st.nextToken();

String pwd = st.nextToken();

System.out.println(user);

System.out.println(pwd);

}

你可能感兴趣的:(字符串,StringTokenizer,分割)