Package org.apache.camel.util
Class StringQuoteHelper
java.lang.Object
org.apache.camel.util.StringQuoteHelper
Utility class for parsing quoted string which is intended for parameters, separated by comma.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdoubleQuote(String text) Returns the text wrapped double quotesstatic StringWraps the text in the given quote textstatic StringsingleQuote(String text) Returns the text wrapped single quotesstatic String[]splitSafeQuote(String input, char separator) Splits the input safely honoring if values is enclosed in quotes.static String[]splitSafeQuote(String input, char separator, boolean trim) Splits the input safely honoring if values is enclosed in quotes.static String[]splitSafeQuote(String input, char separator, boolean trim, boolean keepQuotes) Splits the input safely honoring if values is enclosed in quotes.
-
Method Details
-
doubleQuote
Returns the text wrapped double quotes -
singleQuote
Returns the text wrapped single quotes -
quote
Wraps the text in the given quote text- Parameters:
text- the text to wrap in quotesquote- the quote text added to the prefix and postfix of the text- Returns:
- the text wrapped in the given quotes
-
splitSafeQuote
Splits the input safely honoring if values is enclosed in quotes. Though this method does not support double quoting values. A quoted value must start with the same start and ending quote, which is either a single quote or double quote value. Will trim each split value by default.- Parameters:
input- the inputseparator- the separator char to split the input, for example a comma.- Returns:
- the input split, or null if the input is null.
-
splitSafeQuote
Splits the input safely honoring if values is enclosed in quotes. Though this method does not support double quoting values. A quoted value must start with the same start and ending quote, which is either a single quote or double quote value.- Parameters:
input- the inputseparator- the separator char to split the input, for example a comma.trim- whether to trim each split value- Returns:
- the input split, or null if the input is null.
-
splitSafeQuote
public static String[] splitSafeQuote(String input, char separator, boolean trim, boolean keepQuotes) Splits the input safely honoring if values is enclosed in quotes. Though this method does not support double quoting values. A quoted value must start with the same start and ending quote, which is either a single quote or double quote value.- Parameters:
input- the inputseparator- the separator char to split the input, for example a comma.trim- whether to trim each split valuekeepQuotes- whether to keep quotes- Returns:
- the input split, or null if the input is null.
-