[Nice-commit] Nice/stdlib/nice/lang strings.nice,1.14,1.15
Brought to you by:
bonniot
From: <bo...@us...> - 2004-02-27 17:48:22
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1694/stdlib/nice/lang Modified Files: strings.nice Log Message: Modified split to use a character separator. JDK 1.4 includes a String.split(String), where the second argument is a regexp. It's not necessary to duplicate that functionality, but spliting based on a single character is a useful special case. Index: strings.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/strings.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** strings.nice 19 Nov 2003 16:04:45 -0000 1.14 --- strings.nice 27 Feb 2004 17:39:30 -0000 1.15 *************** *** 69,75 **** * @param str the string to split * @param separator the separator to split on ! */ ! List<String> split(String str, String separator) ! requires separator.length() > 0 : "separator cannot be the empty string" { List<String> res = new ArrayList(); --- 69,74 ---- * @param str the string to split * @param separator the separator to split on ! */ ! List<String> split(String str, char separator) { List<String> res = new ArrayList(); *************** *** 85,89 **** res.add(str.substring(pos, ntx)); } ! pos = ntx + separator.length; } else --- 84,88 ---- res.add(str.substring(pos, ntx)); } ! pos = ntx + 1; } else |