Java Code Examples for org.apache.commons.lang3.StringUtils#stripAccents()
The following examples show how to use
org.apache.commons.lang3.StringUtils#stripAccents() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: account-provisioning-for-google-apps File: Utils.java License: Apache License 2.0 | 6 votes |
/** * 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; }
Example 2
Source Project: pikatimer File: FTPSTransport.java License: GNU General Public License v3.0 | 5 votes |
@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 }
Example 3
Source Project: pikatimer File: LocalTransport.java License: GNU General Public License v3.0 | 5 votes |
@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); } } }
Example 4
Source Project: pikatimer File: SFTPTransport.java License: GNU General Public License v3.0 | 5 votes |
@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); }
Example 5
Source Project: ETSMobile-Android2 File: NewsSourceComparator.java License: Apache License 2.0 | 5 votes |
@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()); }
Example 6
Source Project: metadata-qa-marc File: Utils.java License: GNU General Public License v3.0 | 4 votes |
public static String solarize(String abbreviation) { abbreviation = StringUtils.stripAccents(abbreviation); abbreviation = abbreviation.replaceAll("\\W", "_").toLowerCase(); return abbreviation; }
Example 7
Source Project: EDDI File: ConvertSpecialCharacterNormalizer.java License: Apache License 2.0 | 4 votes |
@Override public String normalize(String input) { return StringUtils.stripAccents(CharacterUtilities.convertSpecialCharacter(input)); }
Example 8
Source Project: rfc-facil File: HomoclaveCalculator.java License: Apache License 2.0 | 3 votes |
private void normalizeFullName() { String rawFullName = person.getFullNameForHomoclave().toUpperCase(); fullName = StringUtils.stripAccents(rawFullName); fullName = fullName.replaceAll("[\\-\\.',]", ""); // remove .'-, fullName = addMissingCharToFullName(rawFullName, 'Ñ'); }
Example 9
Source Project: rfc-facil File: HomoclaveCalculator.java License: Apache License 2.0 | 3 votes |
private void normalizeFullName() { String rawFullName = person.getFullNameForHomoclave().toUpperCase(); fullName = StringUtils.stripAccents(rawFullName); fullName = fullName.replaceAll("[\\-\\.',]", ""); // remove .'-, fullName = addMissingCharToFullName(rawFullName, 'Ñ'); }