Package org.smooks.support
Class DollarBraceDecoder
- java.lang.Object
-
- org.smooks.support.DollarBraceDecoder
-
public class DollarBraceDecoder extends Object
Decoder for Strings containing "${xxxxx}" type patterns.- Author:
- tom.fennelly@gmail.com
-
-
Constructor Summary
Constructors Constructor Description DollarBraceDecoder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>
getTokens(String string)
Get the ${} tokens from the supplied string.static String
replaceTokens(String string, String replacement)
Replace all the ${} tokens with the specified String.
-
-
-
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
-
-
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.
-
-