weka.core.Utils.replaceStrings()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中weka.core.Utils.replaceStrings()方法的一些代码示例,展示了Utils.replaceStrings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.replaceStrings()方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:replaceStrings

Utils.replaceStrings介绍

[英]Converts the specified strings in the given string to the specified characters.
[中]将给定字符串中的指定字符串转换为指定字符。

代码示例

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * The inverse operation of backQuoteChars(). Converts back-quoted carriage
 * returns and new lines in a string to the corresponding character ('\r' and
 * '\n'). Also "un"-back-quotes the following characters: ` " \ \t and %
 *
 * @param string the string
 * @return the converted string
 * @see #backQuoteChars(String)
 */
public static String unbackQuoteChars(String string) {
 String charsFind[] = { "\\\\", "\\'", "\\t", "\\n", "\\r", "\\\"", "\\%", "\\u001E" };
 char charsReplace[] = { '\\', '\'', '\t', '\n', '\r', '"', '%', '\u001E' };
 return replaceStrings(string, charsFind, charsReplace);
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * The inverse operation of backQuoteChars(). Converts back-quoted carriage
 * returns and new lines in a string to the corresponding character ('\r' and
 * '\n'). Also "un"-back-quotes the following characters: ` " \ \t and %
 *
 * @param string the string
 * @return the converted string
 * @see #backQuoteChars(String)
 */
public static String unbackQuoteChars(String string) {
 String charsFind[] = { "\\\\", "\\'", "\\t", "\\n", "\\r", "\\\"", "\\%", "\\u001E" };
 char charsReplace[] = { '\\', '\'', '\t', '\n', '\r', '"', '%', '\u001E' };
 return replaceStrings(string, charsFind, charsReplace);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

optStr = replaceStrings(optStr, toReplace, replacements);
} else {
 optStr = unbackQuoteChars(optStr);

代码示例来源:origin: Waikato/weka-trunk

optStr = replaceStrings(optStr, toReplace, replacements);
} else {
 optStr = unbackQuoteChars(optStr);

相关文章