You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by df...@apache.org on 2002/01/17 20:29:15 UTC

cvs commit: jakarta-oro/src/java/org/apache/oro/text/regex Util.java

dfs         02/01/17 11:29:15

  Modified:    src/java/org/apache/oro/text/regex Util.java
  Log:
  Added missing substitute method from TODO list, updated copyright, and
  fixed incomplete sentence in javadocs.
  
  Revision  Changes    Path
  1.9       +36 -3     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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Util.java	17 May 2001 21:59:35 -0000	1.8
  +++ Util.java	17 Jan 2002 19:29:15 -0000	1.9
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: Util.java,v 1.8 2001/05/17 21:59:35 dfs Exp $
  + * $Id: Util.java,v 1.9 2002/01/17 19:29:15 dfs Exp $
    */
   import java.util.*;
   
  @@ -389,7 +389,40 @@
      * 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
  +   * of the pattern to be replaced.  The number of substitutions made
  +   * is returned.
  +   * <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.5
  +   */
  +  public static int substitute(StringBuffer result,
  +			       PatternMatcher matcher, Pattern pattern,
  +			       Substitution sub, String input,
  +			       int numSubs)
  +  {
  +    PatternMatcherInput pinput = new PatternMatcherInput(input);
  +    return substitute(result, matcher, pattern, sub, pinput, numSubs);
  +  }
  +
  +  /**
  +   * 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 number of substitutions made
  +   * is returned.
      * <p>
      * @param result  The StringBuffer in which to store the result of the
      *                substitutions.  The buffer is only appended to.
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>