org.apache.commons.lang3.StringUtils.convertRemainingAccentCharacters()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(215)

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

StringUtils.convertRemainingAccentCharacters介绍

暂无

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * <p>Removes diacritics (~= accents) from a string. The case will not be altered.</p>
 * <p>For instance, '&agrave;' will be replaced by 'a'.</p>
 * <p>Note that ligatures will be left as is.</p>
 *
 * <pre>
 * StringUtils.stripAccents(null)                = null
 * StringUtils.stripAccents("")                  = ""
 * StringUtils.stripAccents("control")           = "control"
 * StringUtils.stripAccents("&eacute;clair")     = "eclair"
 * </pre>
 *
 * @param input String to be stripped
 * @return input text with diacritics removed
 *
 * @since 3.0
 */
// See also Lucene's ASCIIFoldingFilter (Lucene 2.9) that replaces accented characters by their unaccented equivalent (and uncommitted bug fix: https://issues.apache.org/jira/browse/LUCENE-1343?focusedCommentId=12858907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12858907).
public static String stripAccents(final String input) {
  if(input == null) {
    return null;
  }
  final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
  final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD));
  convertRemainingAccentCharacters(decomposed);
  // Note that this doesn't correctly remove ligatures...
  return pattern.matcher(decomposed).replaceAll(EMPTY);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>Removes diacritics (~= accents) from a string. The case will not be altered.</p>
 * <p>For instance, '&agrave;' will be replaced by 'a'.</p>
 * <p>Note that ligatures will be left as is.</p>
 *
 * <pre>
 * StringUtils.stripAccents(null)                = null
 * StringUtils.stripAccents("")                  = ""
 * StringUtils.stripAccents("control")           = "control"
 * StringUtils.stripAccents("&eacute;clair")     = "eclair"
 * </pre>
 *
 * @param input String to be stripped
 * @return input text with diacritics removed
 *
 * @since 3.0
 */
// See also Lucene's ASCIIFoldingFilter (Lucene 2.9) that replaces accented characters by their unaccented equivalent (and uncommitted bug fix: https://issues.apache.org/jira/browse/LUCENE-1343?focusedCommentId=12858907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12858907).
public static String stripAccents(final String input) {
  if(input == null) {
    return null;
  }
  final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
  final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD));
  convertRemainingAccentCharacters(decomposed);
  // Note that this doesn't correctly remove ligatures...
  return pattern.matcher(decomposed).replaceAll(EMPTY);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>Removes diacritics (~= accents) from a string. The case will not be altered.</p>
 * <p>For instance, '&agrave;' will be replaced by 'a'.</p>
 * <p>Note that ligatures will be left as is.</p>
 *
 * <pre>
 * StringUtils.stripAccents(null)                = null
 * StringUtils.stripAccents("")                  = ""
 * StringUtils.stripAccents("control")           = "control"
 * StringUtils.stripAccents("&eacute;clair")     = "eclair"
 * </pre>
 *
 * @param input String to be stripped
 * @return input text with diacritics removed
 *
 * @since 3.0
 */
// See also Lucene's ASCIIFoldingFilter (Lucene 2.9) that replaces accented characters by their unaccented equivalent (and uncommitted bug fix: https://issues.apache.org/jira/browse/LUCENE-1343?focusedCommentId=12858907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12858907).
public static String stripAccents(final String input) {
  if(input == null) {
    return null;
  }
  final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
  final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD));
  convertRemainingAccentCharacters(decomposed);
  // Note that this doesn't correctly remove ligatures...
  return pattern.matcher(decomposed).replaceAll(EMPTY);
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>Removes diacritics (~= accents) from a string. The case will not be altered.</p>
 * <p>For instance, '&agrave;' will be replaced by 'a'.</p>
 * <p>Note that ligatures will be left as is.</p>
 *
 * <pre>
 * StringUtils.stripAccents(null)                = null
 * StringUtils.stripAccents("")                  = ""
 * StringUtils.stripAccents("control")           = "control"
 * StringUtils.stripAccents("&eacute;clair")     = "eclair"
 * </pre>
 *
 * @param input String to be stripped
 * @return input text with diacritics removed
 *
 * @since 3.0
 */
// See also Lucene's ASCIIFoldingFilter (Lucene 2.9) that replaces accented characters by their unaccented equivalent (and uncommitted bug fix: https://issues.apache.org/jira/browse/LUCENE-1343?focusedCommentId=12858907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12858907).
@GwtIncompatible("incompatible method")
public static String stripAccents(final String input) {
  if(input == null) {
    return null;
  }
  final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$
  final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD));
  convertRemainingAccentCharacters(decomposed);
  // Note that this doesn't correctly remove ligatures...
  return pattern.matcher(decomposed).replaceAll(EMPTY);
}

相关文章

微信公众号

最新文章

更多

StringUtils类方法