You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/26 21:55:23 UTC
[commons-text] 03/03: Tweak toString();
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
commit 37a7cc2a90707d009c4dc94e7433f924701f34ff
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 26 17:55:12 2020 -0400
Tweak toString();
---
.../apache/commons/text/matcher/AbstractStringMatcher.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java b/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
index a9e62a4..ba25f07 100644
--- a/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
+++ b/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
@@ -203,17 +203,21 @@ abstract class AbstractStringMatcher implements StringMatcher {
*/
static final class StringMatcher extends AbstractStringMatcher {
- /** The string to match, as a character array. */
+ /** The string to match, as a character array, implementation treats as immutable. */
private final char[] chars;
+ /** The string to match */
+ private final String string;
+
/**
* Constructs a matcher from a String.
*
* @param str the string to match, must not be null
*/
- StringMatcher(final String str) {
+ StringMatcher(final String string) {
super();
- chars = str.toCharArray();
+ this.string = string;
+ this.chars = string.toCharArray();
}
/**
@@ -276,7 +280,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
@Override
public String toString() {
- return super.toString() + ' ' + Arrays.toString(chars);
+ return super.toString() + "[\"" + string + "\"]";
}
}