Class DollarBraceDecoder

    • Field Detail

      • PATTERN

        public static final String PATTERN
        Match against "${}", where there's at least one of any character except '}' in between the braces ("{}").
        See Also:
        Constant Field Values
    • Constructor Detail

      • DollarBraceDecoder

        public DollarBraceDecoder()
    • Method Detail

      • getTokens

        public static List<String> getTokens​(String string)
        Get the ${} tokens from the supplied string.

        For example, if the input string is "xxxx ${A} xxxxx ${B} ...", this method will return a List containing 2 String, "A" and "B".

        Parameters:
        string - The String from which to extract the ${} tokens.
        Returns:
        The list of tokens.
      • replaceTokens

        public static String replaceTokens​(String string,
                                           String replacement)
        Replace all the ${} tokens with the specified String.

        For example, if the input string is "xxxx ${A} xxxxx ${B} ..." and the replacement String "?", this method will return "xxxx ? xxxxx ? ...".

        Parameters:
        string - The String on which to perform the replacement.
        replacement - The replacement string.
        Returns:
        The String with the tokens replaced.