dfs 01/05/17 14:39:15
Modified: src/java/org/apache/oro/text/regex Util.java
Log:
Added documentation to the new substitute method.
Revision Changes Path
1.7 +23 -1 jakarta-oro/src/java/org/apache/oro/text/regex/Util.java
Index: Util.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Util.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Util.java 2001/05/17 21:16:14 1.6
+++ Util.java 2001/05/17 21:39:12 1.7
@@ -59,7 +59,7 @@
import java.util.*;
/*
- * $Id: Util.java,v 1.6 2001/05/17 21:16:14 dfs Exp $
+ * $Id: Util.java,v 1.7 2001/05/17 21:39:12 dfs Exp $
*/
/**
@@ -383,6 +383,28 @@
return substitute(matcher, pattern, sub, input, 1);
}
+ /**
+ * Searches a string for a pattern and replaces the first occurrences
+ * of the pattern with a Substitution up to the number of
+ * substitutions specified by the <b>numSubs</b> parameter. A
+ * <b>numSubs</b> value of <b>SUBSTITUTE_ALL</b> will cause all occurrences
+ * of the pattern to be replaced. The
+ * <p>
+ * @param result The StringBuffer in which to store the result of the
+ * substitutions. The buffer is only appended to.
+ * @param matcher The regular expression matcher to execute the pattern
+ * search.
+ * @param pattern The regular expression to search for and substitute
+ * occurrences of.
+ * @param sub The Substitution used to substitute pattern occurences.
+ * @param input The input on which to perform substitutions.
+ * @param numSubs The number of substitutions to perform. Only the
+ * first <b> numSubs </b> patterns encountered are
+ * substituted. If you want to substitute all occurences
+ * set this parameter to <b> SUBSTITUTE_ALL </b>.
+ * @return The number of substitutions made.
+ * @since 2.0.3
+ */
public static int substitute(StringBuffer result,
PatternMatcher matcher, Pattern pattern,
Substitution sub, PatternMatcherInput input,