截取字符串。在线等,向高手请教
有一字符串 "123456,abcde " 用什么办法可以截取 ", "之前的数字。“,”之前的数字长度会变。请各位高手指教
------解决方案--------------------public static void main(String[] args) {
String s = "234234,asdfsd ";
StringTokenizer st = new StringTokenizer(s, "[,] ");
System.out.println(st.nextToken());
}