Java String Normalize normalizeEnglishIdentifier(String id)

Here you can find the source of normalizeEnglishIdentifier(String id)

Description

Remove anything that is not English letters or digits from the string and convert what wasn't removed to lower case.

License

Open Source License

Parameter

Parameter Description
id The string to be worked

Return

A string that matches /^[a-zA-Z0-9]*$/ , note that it may be empty

Declaration

public static String normalizeEnglishIdentifier(String id) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.Normalizer;

public class Main {
    /**//from w  w w  . ja  v a2  s. c  o  m
     * Remove anything that is not English letters or digits from the string and convert what wasn't removed to lower case.
     * Accents are also removed from letters.
     * @param id The string to be worked
     * @return A string that matches {@code /^[a-zA-Z0-9]*$/}, note that it may be empty
     */
    public static String normalizeEnglishIdentifier(String id) {
        return Normalizer.normalize(id, Normalizer.Form.NFD).replaceAll("[^a-zA-Z0-9]", "")
                //.replaceAll("\\p{Blank}+", " ")
                .toLowerCase();
    }
}

Related

  1. normalize(String uri)
  2. normalize(String value)
  3. normalize(String value, Locale locale)
  4. normalizeCutter(String cutter, int numDigits)
  5. normalizeDose(String dose)
  6. normalizeFieldNameOrPath(final String nameOrPath)
  7. normalizeIndex(String input, String[] indexList)
  8. normalizeMatchup(final String matchup)
  9. normalizePackageNamePart(String name)