@Immutable public final class TextVariableHelper extends Object
${bla}.
The variable helper supports masking with the backslash (\)
character so that the "$" can be represented as "\$".| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsVariables(String sSourceString)
Quickly check if a string contains a variable.
|
static void |
forEachTextAndVariable(String sSourceString,
Consumer<String> aTextFragmentHandler,
Consumer<String> aVariableNameHandler)
Parse the provided source string looking for variables in the form
${...} |
static String |
getWithReplacedVariables(String sSourceString,
UnaryOperator<String> aVariableProvider) |
public static boolean containsVariables(@Nullable String sSourceString)
sSourceString - the string to check for variables.true if at least one variable is contained,
false if not.public static void forEachTextAndVariable(@Nullable String sSourceString, @Nonnull Consumer<String> aTextFragmentHandler, @Nonnull Consumer<String> aVariableNameHandler)
${...} and invoke callbacks for either text fragments or
variable names.sSourceString - The source string to parse and analyze. May be null.aTextFragmentHandler - The callback to be invoked for each text fragment. May not be
null.aVariableNameHandler - The callback to be invoked for each variable name. May not be
null.Copyright © 2014–2022 Philip Helger. All rights reserved.