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 2018/09/27 22:11:46 UTC

[text] Extract constants.

Repository: commons-text
Updated Branches:
  refs/heads/master 5857ffc3e -> 1898b786a


Extract constants.

Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/1898b786
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/1898b786
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/1898b786

Branch: refs/heads/master
Commit: 1898b786ac35cfd7ba2f21c41ade284f6df36af2
Parents: 5857ffc
Author: Gary Gregory <gg...@rocketsoftware.com>
Authored: Thu Sep 27 16:11:43 2018 -0600
Committer: Gary Gregory <gg...@rocketsoftware.com>
Committed: Thu Sep 27 16:11:43 2018 -0600

----------------------------------------------------------------------
 .../apache/commons/text/StringSubstitutor.java  | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/1898b786/src/main/java/org/apache/commons/text/StringSubstitutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/StringSubstitutor.java b/src/main/java/org/apache/commons/text/StringSubstitutor.java
index 4fcbc4b..8d98ecf 100644
--- a/src/main/java/org/apache/commons/text/StringSubstitutor.java
+++ b/src/main/java/org/apache/commons/text/StringSubstitutor.java
@@ -135,6 +135,27 @@ import org.apache.commons.text.matcher.StringMatcherFactory;
 public class StringSubstitutor {
 
     /**
+     * The default variable default separator.
+     * 
+     * @since 1.5.
+     */
+    public static final String DEFAULT_VAR_DEFAULT = ":-";
+
+    /**
+     * The default variable end separator.
+     * 
+     * @since 1.5.
+     */
+    public static final String DEFAULT_VAR_END = "}";
+
+    /**
+     * The default variable start separator.
+     * 
+     * @since 1.5.
+     */
+    public static final String DEFAULT_VAR_START = "${";
+
+    /**
      * Constant for the default escape character.
      */
     public static final char DEFAULT_ESCAPE = '$';
@@ -142,17 +163,17 @@ public class StringSubstitutor {
     /**
      * Constant for the default variable prefix.
      */
-    public static final StringMatcher DEFAULT_PREFIX = StringMatcherFactory.INSTANCE.stringMatcher("${");
+    public static final StringMatcher DEFAULT_PREFIX = StringMatcherFactory.INSTANCE.stringMatcher(DEFAULT_VAR_START);
 
     /**
      * Constant for the default variable suffix.
      */
-    public static final StringMatcher DEFAULT_SUFFIX = StringMatcherFactory.INSTANCE.stringMatcher("}");
+    public static final StringMatcher DEFAULT_SUFFIX = StringMatcherFactory.INSTANCE.stringMatcher(DEFAULT_VAR_END);
 
     /**
      * Constant for the default value delimiter of a variable.
      */
-    public static final StringMatcher DEFAULT_VALUE_DELIMITER = StringMatcherFactory.INSTANCE.stringMatcher(":-");
+    public static final StringMatcher DEFAULT_VALUE_DELIMITER = StringMatcherFactory.INSTANCE.stringMatcher(DEFAULT_VAR_DEFAULT);
 
     // -----------------------------------------------------------------------
     /**