From: Svjatoslav Agejenko Date: Sun, 30 Aug 2020 20:34:57 +0000 (+0300) Subject: show regexp groups, handy for debugging X-Git-Tag: svjatoslavcommons-1.8~6 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=8e658dfab85ad198d4003c7d58c840ba6029e031;p=svjatoslav_commons.git show regexp groups, handy for debugging --- diff --git a/src/main/java/eu/svjatoslav/commons/string/tokenizer/TokenizerMatch.java b/src/main/java/eu/svjatoslav/commons/string/tokenizer/TokenizerMatch.java index ebe5175..cd07ec9 100755 --- a/src/main/java/eu/svjatoslav/commons/string/tokenizer/TokenizerMatch.java +++ b/src/main/java/eu/svjatoslav/commons/string/tokenizer/TokenizerMatch.java @@ -50,10 +50,19 @@ public class TokenizerMatch { @Override public String toString() { - return "TokenizerMatch{" + - "token='" + token + '\'' + - ", terminator=" + terminator + - '}'; + StringBuilder result = new StringBuilder(); + result.append("TokenizerMatch\n" + + " token='" + token + "'\n" + + " terminator=" + terminator + "\n" + + " groups:\n"); + + int i = 0; + for (String s : getRegExpGroups()) { + result.append(" " + i + ": " + s + "\n"); + i++; + } + + return result.toString(); } public Tokenizer getTokenizer() {