Here you can find the source of quote(String str, String quoteChar)
Parameter | Description |
---|---|
str | the input String (e.g. "myString") |
quoteChar | Character to use for quote. |
null if the input was null
Declaration
public static String quote(String str, String quoteChar)
Method Source Code
//package com.java2s;
//License from project: LGPL
public class Main {
/**/*from ww w. j av a 2 s .c om*/
* Quote the given String with single quotes.
*
* @param str the input String (e.g. "myString")
* @return the quoted String (e.g. "'myString'"), or
* <code>null<code> if the input was
* <code>null</code>
*/
public static String quote(String str) {
return (str != null ? "'" + str + "'" : null);
}
/**
* Quote the given String with passed quoteChar.
*
* @param str the input String (e.g. "myString")
* @param quoteChar Character to use for quote.
* @return the quoted String (e.g. "'myString'"), or
* <code>null<code> if the input was
* <code>null</code>
*/
public static String quote(String str, String quoteChar) {
return (str != null ? quoteChar + str + quoteChar : null);
}
}
Related