src/java.base/share/classes/java/util/regex/Matcher.java

Print this page
rev 10552 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


1278      * @return this matcher
1279      * @see java.util.regex.Matcher#hasAnchoringBounds
1280      * @since 1.5
1281      */
1282     public Matcher useAnchoringBounds(boolean b) {
1283         anchoringBounds = b;
1284         return this;
1285     }
1286 
1287     /**
1288      * <p>Returns the string representation of this matcher. The
1289      * string representation of a <code>Matcher</code> contains information
1290      * that may be useful for debugging. The exact format is unspecified.
1291      *
1292      * @return  The string representation of this matcher
1293      * @since 1.5
1294      */
1295     public String toString() {
1296         StringBuilder sb = new StringBuilder();
1297         sb.append("java.util.regex.Matcher");
1298         sb.append("[pattern=" + pattern());
1299         sb.append(" region=");
1300         sb.append(regionStart() + "," + regionEnd());
1301         sb.append(" lastmatch=");
1302         if ((first >= 0) && (group() != null)) {
1303             sb.append(group());
1304         }
1305         sb.append("]");
1306         return sb.toString();
1307     }
1308 
1309     /**
1310      * <p>Returns true if the end of input was hit by the search engine in
1311      * the last match operation performed by this matcher.
1312      *
1313      * <p>When this method returns true, then it is possible that more input
1314      * would have changed the result of the last search.
1315      *
1316      * @return  true iff the end of input was hit in the last match; false
1317      *          otherwise
1318      * @since 1.5
1319      */
1320     public boolean hitEnd() {
1321         return hitEnd;
1322     }
1323 
1324     /**
1325      * <p>Returns true if more input could change a positive match into a




1278      * @return this matcher
1279      * @see java.util.regex.Matcher#hasAnchoringBounds
1280      * @since 1.5
1281      */
1282     public Matcher useAnchoringBounds(boolean b) {
1283         anchoringBounds = b;
1284         return this;
1285     }
1286 
1287     /**
1288      * <p>Returns the string representation of this matcher. The
1289      * string representation of a <code>Matcher</code> contains information
1290      * that may be useful for debugging. The exact format is unspecified.
1291      *
1292      * @return  The string representation of this matcher
1293      * @since 1.5
1294      */
1295     public String toString() {
1296         StringBuilder sb = new StringBuilder();
1297         sb.append("java.util.regex.Matcher");
1298         sb.append("[pattern=").append(pattern());
1299         sb.append(" region=");
1300         sb.append(regionStart()).append(',').append(regionEnd());
1301         sb.append(" lastmatch=");
1302         if ((first >= 0) && (group() != null)) {
1303             sb.append(group());
1304         }
1305         sb.append(']');
1306         return sb.toString();
1307     }
1308 
1309     /**
1310      * <p>Returns true if the end of input was hit by the search engine in
1311      * the last match operation performed by this matcher.
1312      *
1313      * <p>When this method returns true, then it is possible that more input
1314      * would have changed the result of the last search.
1315      *
1316      * @return  true iff the end of input was hit in the last match; false
1317      *          otherwise
1318      * @since 1.5
1319      */
1320     public boolean hitEnd() {
1321         return hitEnd;
1322     }
1323 
1324     /**
1325      * <p>Returns true if more input could change a positive match into a