Hi,

I am not sure of what java.util.regex.Matcher#hitEnd() should return,
but this is my proposed patch.

ChangeLog:
2006-07-29  Ito Kazumitsu  <[EMAIL PROTECTED]>

        Fixes bug #28412
        * java/util/regex/Matcher.java(hitEnd): New method.

Index: classpath/java/util/regex/Matcher.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/regex/Matcher.java,v
retrieving revision 1.17
diff -u -r1.17 Matcher.java
--- classpath/java/util/regex/Matcher.java      7 Jun 2006 19:30:06 -0000       
1.17
+++ classpath/java/util/regex/Matcher.java      29 Jul 2006 01:20:34 -0000
@@ -309,6 +309,16 @@
     return match.getStartIndex(group);
   }
 
+  /**
+   * @return True if the end of input was hit in the last match;
+   * False otherwise.
+   */
+  public boolean hitEnd()
+  {
+    assertMatchOp();
+    return (match.getEndIndex() == input.length());
+  }
+
   private void assertMatchOp()
   {
     if (match == null) throw new IllegalStateException();

Reply via email to