Package de.xima.fc.helper
Class PlaceholderStringTokenizer
java.lang.Object
de.xima.fc.helper.PlaceholderStringTokenizer
Helper for splitting strings containing placeholders into the surrounding text and the placeholders.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a non-placeholder part of a string.static final classRepresents a placeholder part of a string.static classRepresents either a literal (non-placeholder) or placeholder part of a string. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringTakes a list of parts produced bytokenize(String)and converts it back into a string.static final List<PlaceholderStringTokenizer.PlaceholderStringToken>Takes a string that may contain placeholders and splits it into the literal (non-placeholder) parts and the placeholder parts.
-
Constructor Details
-
PlaceholderStringTokenizer
public PlaceholderStringTokenizer()
-
-
Method Details
-
stringify
public static final String stringify(Iterable<PlaceholderStringTokenizer.PlaceholderStringToken> tokens) Takes a list of parts produced bytokenize(String)and converts it back into a string.- Parameters:
tokens- Tokens to convert back into a string.- Returns:
- The string that represents the tokens.
-
tokenize
Takes a string that may contain placeholders and splits it into the literal (non-placeholder) parts and the placeholder parts. For example,hello [%tf1%] worldwould be split into the literal<hello >, the placeholder<tf1>, and the literal< world>.- Parameters:
value- A string to split that may contain placeholders.- Returns:
- The parts of the string, each element is either a
PlaceholderStringTokenizer.PlaceholderStringLiteralTokenorPlaceholderStringTokenizer.PlaceholderStringPlaceholderToken.
-