org.apache.commons.lang3.StringUtils#stripAccents ( )源码实例Demo

下面列出了org.apache.commons.lang3.StringUtils#stripAccents ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Replaces special characters to e-mail valid characters.
 *
 * @param username User name to be formatted.
 * @return Formatted text
 */
public static String replaceSpecialChars(String username) {
  if (username == null) {
    return null;
  }
  username = username.toLowerCase();
  // Replaces characters with accents for the same characters without accents.
  username = StringUtils.stripAccents(username);
  // Filters e-mail valid characters
  username = username.replaceAll(REGEXP_SPECIAL_CHARS, "");
  // The maximum Google Apps username length is 60 characters
  if (username.length() > USERNAME_MAX_LENGTH) {
    username = username.substring(0, USERNAME_MAX_LENGTH);
  }
  return username;
}
 
源代码2 项目: pikatimer   文件: FTPSTransport.java
@Override
public void save(String filename, String contents) {
    System.out.println("FTPSTransport.save() called for " + filename);
    if (stripAccents) contents = StringUtils.stripAccents(contents);
    transferMap.put(filename,contents);
    if (! transferQueue.contains(filename)) transferQueue.add(filename);
    
    //if (transferThread == null || ftpClient == null || !ftpClient.isConnected() ) transferFile(); // kicks off the thread
}
 
源代码3 项目: pikatimer   文件: LocalTransport.java
@Override
    public void save(String filename, String contents) {
        System.out.println("LocalTransport.save called for " + filename);
        
        //String Accented chars if needed
        if (stripAccents) contents = StringUtils.stripAccents(contents);
        
        //Fix the newlines
        contents = contents.replaceAll("\\R", System.lineSeparator()); 
        
        
        if (goodToGo && ! basePath.isEmpty()) {
            
            try {
                Platform.runLater(() -> {transferStatus.set("Saving: " + filename);});
//                try {
//                    Thread.sleep(3000);
//                } catch (InterruptedException ex) {
//                    Logger.getLogger(LocalTransport.class.getName()).log(Level.SEVERE, null, ex);
//                }
                FileUtils.writeStringToFile(new File(FilenameUtils.concat(basePath, filename)), '\ufeff' + contents, StandardCharsets.UTF_8);
                Platform.runLater(() -> {transferStatus.set("Idle");});
            } catch (IOException ex) {
                Platform.runLater(() -> {transferStatus.set("ERROR! " + filename);});
                Logger.getLogger(LocalTransport.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
 
源代码4 项目: pikatimer   文件: SFTPTransport.java
@Override
public void save(String filename, String contents) {
    System.out.println("SFTPTransport.save() called for " + filename);
    if (stripAccents) contents = StringUtils.stripAccents(contents);
    transferMap.put(filename,contents);
    if (! transferQueue.contains(filename)) transferQueue.add(filename);
}
 
源代码5 项目: ETSMobile-Android2   文件: NewsSourceComparator.java
@Override
public int compare(NewsSource newsSource1, NewsSource newsSource2) {

    String sourceName1 = StringUtils.stripAccents(newsSource1.getName());
    String sourceName2 = StringUtils.stripAccents(newsSource2.getName());

    return sourceName1.toLowerCase().compareTo(sourceName2.toLowerCase());
}
 
源代码6 项目: metadata-qa-marc   文件: Utils.java
public static String solarize(String abbreviation) {
  abbreviation = StringUtils.stripAccents(abbreviation);
  abbreviation = abbreviation.replaceAll("\\W", "_").toLowerCase();
  return abbreviation;
}
 
源代码7 项目: EDDI   文件: ConvertSpecialCharacterNormalizer.java
@Override
public String normalize(String input) {
    return StringUtils.stripAccents(CharacterUtilities.convertSpecialCharacter(input));
}
 
源代码8 项目: rfc-facil   文件: HomoclaveCalculator.java
private void normalizeFullName() {

        String rawFullName = person.getFullNameForHomoclave().toUpperCase();

        fullName = StringUtils.stripAccents(rawFullName);
        fullName = fullName.replaceAll("[\\-\\.',]", ""); // remove .'-,
        fullName = addMissingCharToFullName(rawFullName, 'Ñ');

    }
 
源代码9 项目: rfc-facil   文件: HomoclaveCalculator.java
private void normalizeFullName() {

        String rawFullName = person.getFullNameForHomoclave().toUpperCase();

        fullName = StringUtils.stripAccents(rawFullName);
        fullName = fullName.replaceAll("[\\-\\.',]", ""); // remove .'-,
        fullName = addMissingCharToFullName(rawFullName, 'Ñ');

    }
 
 同类方法