From 2257a019e4010d912f55ad118a85c182887b7c30 Mon Sep 17 00:00:00 2001 From: Daniel Rall Date: Fri, 30 Aug 2002 02:52:54 +0000 Subject: [PATCH] split(String, String, int): Integrated some good suggested improvements from John Yu . split(String, String): Referenced split(String, String, int) to avoid maintainence overhead of duplicated JavaDoc. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136999 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang/StringUtils.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/commons/lang/StringUtils.java b/src/java/org/apache/commons/lang/StringUtils.java index 912152adf..de699d140 100644 --- a/src/java/org/apache/commons/lang/StringUtils.java +++ b/src/java/org/apache/commons/lang/StringUtils.java @@ -81,7 +81,7 @@ import java.util.Iterator; * @author Ed Korthof * @author Stephen Colebourne - * @version $Id: StringUtils.java,v 1.7 2002/08/23 08:00:26 scolebourne Exp $ + * @version $Id: StringUtils.java,v 1.8 2002/08/30 02:52:54 dlr Exp $ */ public class StringUtils { @@ -406,14 +406,7 @@ public class StringUtils { } /** - * Splits the provided text into a list, based on a given separator. - * The separator is not included in the returned String array. - * A null separator will cause parsing to be on whitespace. - * - * @param str the string to parse - * @param separator The separator character. If null, splits - * on whitespace. - * @return an array of parsed Strings + * @see #split(String, String, int) */ public static String[] split(String text, String separator) { return split(text, separator, -1); @@ -425,11 +418,15 @@ public class StringUtils { * The maximum number of splits to perfom can be controlled. * A null separator will cause parsing to be on whitespace. * - * @param str the string to parse - * @param separator The separator character. If null, splits - * on whitespace. - * @param max The maximum number of elements to include in the - * list. A zero or negative value implies no limit. + *

This is useful for quickly splitting a string directly into + * an array of tokens, instead of an enumeration of tokens (as + * StringTokenizer does). + * + * @param str The string to parse. + * @param separator Characters used as the delimiters. If + * null, splits on whitespace. + * @param max The maximum number of elements to include in the + * list. A zero or negative value implies no limit. * @return an array of parsed Strings */ public static String[] split(String text, String separator, int max) {