Java String Normalize normalizeString(String token)

Here you can find the source of normalizeString(String token)

Description

normalize String

License

Apache License

Declaration

public static String normalizeString(String token) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    private static final char[] CHARACTER_REPLACE_MAPPING = new char[256];

    public static String normalizeString(String token) {
        char[] charArray = token.toCharArray();
        char[] toReturn = new char[charArray.length];
        int index = 0;

        for (int i = 0; i < charArray.length; i++) {
            char x = charArray[i];
            if (x < CHARACTER_REPLACE_MAPPING.length) {
                if (CHARACTER_REPLACE_MAPPING[x] > 0) {
                    toReturn[index++] = CHARACTER_REPLACE_MAPPING[x];
                }//  w  w w  .  j ava2 s .  c o m
            }
        }

        return String.valueOf(Arrays.copyOf(toReturn, index));
    }
}

Related

  1. normalizePackageNamePart(String name)
  2. normalizeRepositoryName(String input)
  3. normalizeSearchString(String src)
  4. normalizeString(String input)
  5. normalizeString(String str)
  6. normalizeSuffix(String suffix)
  7. normalizeTestAndSplit(String text)
  8. normalizeTibetan(String s)
  9. normalizeToAlpha(String input)