[jsword-svn] common/java/core/org/crosswire/common/util s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Sun Feb 27 19:21:33 MST 2005
Update of /cvs/jsword/common/java/core/org/crosswire/common/util
In directory www.crosswire.org:/tmp/cvs-serv26327/java/core/org/crosswire/common/util
Modified Files:
StringUtil.java Histogram.java
Log Message:
Fixed the display of the conf (BD-16, 17 & 18)
Index: Histogram.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/Histogram.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Histogram.java 3 Oct 2004 14:04:06 -0000 1.1
--- Histogram.java 28 Feb 2005 02:21:31 -0000 1.2
***************
*** 56,59 ****
--- 56,63 ----
}
+ public void clear()
+ {
+ hist.clear();
+ }
/**
* The format of the histogram is an unordered list
Index: StringUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/util/StringUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** StringUtil.java 28 Nov 2004 21:36:31 -0000 1.5
--- StringUtil.java 28 Feb 2005 02:21:31 -0000 1.6
***************
*** 243,246 ****
--- 243,307 ----
/**
+ * <p>Splits the provided text into an array, separator specified.
+ * This is an alternative to using StringTokenizer.</p>
+ *
+ * <p>The separator is not included in the returned String array.
+ * Adjacent separators are treated individually.</p>
+ *
+ * <p>A <code>null</code> input String returns <code>null</code>.</p>
+ *
+ * <pre>
+ * StringUtils.split(null, *) = null
+ * StringUtils.split("", *) = []
+ * StringUtils.split("a.b.c", '.') = ["a", "b", "c"]
+ * StringUtils.split("a..b.c", '.') = ["a", "b", "c"]
+ * StringUtils.split("a:b:c", '.') = ["a:b:c"]
+ * StringUtils.split("a\tb\nc", null) = ["a", "b", "c"]
+ * StringUtils.split("a b c", ' ') = ["a", "b", "c"]
+ * </pre>
+ *
+ * @param str the String to parse, may be null
+ * @param separatorChar the character used as the delimiter,
+ * <code>null</code> splits on whitespace
+ * @return an array of parsed Strings, <code>null</code> if null String input
+ * @since 2.0
+ */
+ public static String[] splitAll(String str, char separatorChar)
+ {
+ // Performance tuned for 2.0 (JDK1.4)
+
+ if (str == null)
+ {
+ return null;
+ }
+ int len = str.length();
+ if (len == 0)
+ {
+ return EMPTY_STRING_ARRAY;
+ }
+ List list = new ArrayList();
+ int i = 0;
+ int start = 0;
+ boolean match = false;
+ while (i < len)
+ {
+ if (str.charAt(i) == separatorChar)
+ {
+ list.add(str.substring(start, i));
+ start = ++i;
+ match = false;
+ continue;
+ }
+ match = true;
+ i++;
+ }
+ if (match)
+ {
+ list.add(str.substring(start, i));
+ }
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
+ /**
* <p>Splits the provided text into an array, separators specified.
* This is an alternative to using StringTokenizer.</p>
More information about the jsword-svn
mailing list