Package org.apache.camel.util
Class StringQuoteHelper
- java.lang.Object
-
- org.apache.camel.util.StringQuoteHelper
-
public final class StringQuoteHelper extends Object
Utility class for parsing quoted string which is intended for parameters, separated by comma.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
doubleQuote(String text)
Returns the text wrapped double quotesstatic String
quote(String text, String quote)
Wraps the text in the given quote textstatic String
singleQuote(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.
-
-
-
Method Detail
-
doubleQuote
public static String doubleQuote(String text)
Returns the text wrapped double quotes
-
singleQuote
public static String singleQuote(String text)
Returns the text wrapped single quotes
-
quote
public static String quote(String text, String 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
public static String[] splitSafeQuote(String input, char separator)
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
public static String[] splitSafeQuote(String input, char separator, boolean trim)
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.
-
-