本文整理匯總了Java中org.teiid.core.util.StringUtil.replaceAll方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.replaceAll方法的具體用法?Java StringUtil.replaceAll怎麽用?Java StringUtil.replaceAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.teiid.core.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.replaceAll方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: log
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
@Override
public void log(int level, String context, Throwable t, Object... msg) {
Logger logger = getLogger(context);
Level jbossLevel = convert2JbossLevel(level);
if (msg.length == 0) {
logger.log(jbossLevel, null, t);
}
else if (msg.length == 1 && !(msg[0] instanceof String)) {
String msgStr = StringUtil.toString(msg, " ", false); //$NON-NLS-1$
if (msgStr.indexOf('%') > -1) {
msgStr = StringUtil.replaceAll(msgStr, "%", "%%"); //$NON-NLS-1$ //$NON-NLS-2$
}
logger.logf(jbossLevel, t, msgStr, msg);
}
else {
logger.log(jbossLevel, StringUtil.toString(msg, " ", false), t); //$NON-NLS-1$
}
}
示例2: unescapeId
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
private String unescapeId(String key) {
if (key.startsWith("\"")) { //$NON-NLS-1$
key = key.substring(1, key.length() - 1);
key = StringUtil.replaceAll(key, "\"\"", "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
return key;
}
示例3: escapeString
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
/**
* Creates a SQL-safe string. Simply replaces all occurrences of ' with ''
* @param str the input string
* @return a SQL-safe string
*/
protected String escapeString(String str) {
// needs escaping + - && || ! ( ) { } [ ] ^ " ~ * ? :
// source: http://khaidoan.wikidot.com/solr
String[] array = {"+", "-", "&&", "||", "!", "(", ")", "{", "}", "[", "]", "^", "\"", "~", "*", "?", ":"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
for (int i = 0; i < array.length; i++) {
str = StringUtil.replaceAll(str, array[i], "\\" + array[i]); //$NON-NLS-1$
}
return str;
}
示例4: removeEscapeChars
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
static String removeEscapeChars(String str, String tickChar) {
return StringUtil.replaceAll(str, tickChar + tickChar, tickChar);
}
示例5: replace
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
public static Object replace(String string, String subString, String replaceString) {
return StringUtil.replaceAll(string, subString, replaceString);
}
示例6: escapeString
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
protected String escapeString(String str, String quote) {
return StringUtil.replaceAll(str, quote, quote + quote);
}
示例7: convertToken
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
protected Object convertToken(String group) {
switch (group.charAt(0)) {
case 'G':
return "AD"; //$NON-NLS-1$
case 'y':
if (group.length() == 2) {
return "YY"; //$NON-NLS-1$
}
return "YYYY"; //$NON-NLS-1$
case 'M':
if (group.length() == 2) {
return "MM"; //$NON-NLS-1$
}
if (group.length() == 3) {
return "Mon"; //$NON-NLS-1$
}
return "Month"; //$NON-NLS-1$
case 'D':
return "DDD"; //$NON-NLS-1$
case 'd':
return "DD"; //$NON-NLS-1$
case 'E':
if (group.length() >= 4) {
return "Day"; //$NON-NLS-1$
}
return "Dy"; //$NON-NLS-1$
case 'a':
return "AM"; //$NON-NLS-1$
case 'H':
return "HH24"; //$NON-NLS-1$
case 'h':
return "HH"; //$NON-NLS-1$
case 'm':
return "MI"; //$NON-NLS-1$
case 's':
return "SS"; //$NON-NLS-1$
case 'S':
return "FF" + group.length(); //$NON-NLS-1$
case 'Z':
return "TZHTZM";//$NON-NLS-1$
case '\'':
return '"' + StringUtil.replaceAll(StringUtil.replaceAll(StringUtil.replaceAll(group.substring(1, group.length() - 1), "''", "'"), "'", "''"), "\"", "\"\"") + '"'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
case ' ':
case '-':
case '/':
case ',':
case '.':
case ';':
case ':':
return group;
default:
return '"' + group + '"';
}
}
示例8: quoteName
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
protected String quoteName(String name) {
if (quoteNameInSource && quoteString != null) {
return quoteString + StringUtil.replaceAll(name, quoteString, quoteString + quoteString) + quoteString;
}
return name;
}
示例9: escapeString
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
/**
* Creates a SQL-safe string. Simply replaces all occurrences of ' with ''
* @param str the input string
* @return a SQL-safe string
*/
protected String escapeString(String str, String quote) {
return StringUtil.replaceAll(str, quote, quote + quote);
}
示例10: escapeStringValue
import org.teiid.core.util.StringUtil; //導入方法依賴的package包/類
/**
* Take a string literal and escape it as necessary. By default, this converts ' to ''.
*
* @param str String literal value (unquoted), never null
* @return Escaped string literal value
*/
static String escapeStringValue( String str,
String tick ) {
return StringUtil.replaceAll(str, tick, tick + tick);
}