对形如"a,b,c,d,e"类字符串的解析,所用的正则表达式:[\\s*,*\\s]
Scanner sc = new Scanner(System.in);
Pattern p = Pattern.compile("[\\s*,*\\s]");
sc.useDelimiter(p);
或者
Scanner sc = new Scanner(System.in);
sc.useDelimiter("[\\s*,*\\s]");
A Scanner
breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods。