[Nice-commit] Nice/src/nice/tools/util System.java,1.4,1.5
Brought to you by:
bonniot
From: <bo...@us...> - 2004-02-28 14:33:13
|
Update of /cvsroot/nice/Nice/src/nice/tools/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16026/src/nice/tools/util Modified Files: System.java Log Message: Methods now specialize other methods with a larger domain (ignoring subtyping on non-dispatchable types like primitive and tuple types). Covariance of the return type is not yet checked, and there is not yet a way to explicitely declare that a method is a specialization. Index: System.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/util/System.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** System.java 30 Oct 2001 15:38:24 -0000 1.4 --- System.java 28 Feb 2004 14:23:42 -0000 1.5 *************** *** 22,25 **** --- 22,28 ---- import java.text.DateFormat; + import java.util.List; + import java.util.ArrayList; + /** Communication with the system environment. *************** *** 87,89 **** --- 90,121 ---- private static final DateFormat longDate = DateFormat.getDateTimeInstance(); + + /** + String operations. + */ + + public static String[] split(String str, char separator) + { + List res = new ArrayList(); + int ntx = 0; + int pos = 0; + while(ntx > -1) + { + ntx = str.indexOf(separator, pos); + if (ntx > -1) + { + if (ntx > 0) + { + res.add(str.substring(pos, ntx)); + } + pos = ntx + 1; + } + else + { + res.add(pos == 0 ? str : str.substring(pos)); + } + } + + return (String[]) res.toArray(new String[res.size()]); + } } |