Package com._1c.g5.v8.dt.common
Class StringUtils.Rewriter
java.lang.Object
com._1c.g5.v8.dt.common.StringUtils.Rewriter
- Enclosing class:
- StringUtils
A
matcher
-based string rewriter.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongroup
(int i) Returns the input subsequence captured by the given group during the previous match operation.abstract String
Overridden to compute a replacement for each match.rewrite
(CharSequence original) Returns the result of rewriting 'original' by invoking the method 'replacement' for each match of the regular expression supplied to the constructor.
-
Constructor Details
-
Rewriter
Constructs a rewriter using the given regular expression; the syntax is the same as for 'Pattern.compile'.- Parameters:
regex
- Regular expression to find substrings to replace
-
-
Method Details
-
group
Returns the input subsequence captured by the given group during the previous match operation.- Parameters:
i
- Group number- Returns:
- Subsequence by number
-
replacement
Overridden to compute a replacement for each match. Use the method 'group' to access the captured groups.- Returns:
- The string that will replace the current group found by the matcher
-
rewrite
Returns the result of rewriting 'original' by invoking the method 'replacement' for each match of the regular expression supplied to the constructor.- Parameters:
original
- The character sequence to be rewritten- Returns:
- Rewritten sequence as a string
-