Java String Normalize normalizeIndex(String input, String[] indexList)

Here you can find the source of normalizeIndex(String input, String[] indexList)

Description

normalize Index

License

Open Source License

Declaration

public static String normalizeIndex(String input, String[] indexList) throws IOException 

Method Source Code

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

import java.io.IOException;

import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.Arrays;

public class Main {
    public static String normalizeIndex(String input, String[] indexList) throws IOException {
        String normalizedStr = Normalizer.normalize(input, Form.NFKD).toUpperCase();
        normalizedStr = normalizedStr.substring(0, 1);

        //         if (Character.isLetterOrDigit(normalizedStr.charAt(0))){
        //            return normalizedStr.substring(0,1);   
        //         }
        if (Arrays.asList(indexList).contains(normalizedStr)) {
            return normalizedStr;
        } else {//w ww. jav a 2 s  .com
            return "Char";
        }
    }
}

Related

  1. normalize(String value, Locale locale)
  2. normalizeCutter(String cutter, int numDigits)
  3. normalizeDose(String dose)
  4. normalizeEnglishIdentifier(String id)
  5. normalizeFieldNameOrPath(final String nameOrPath)
  6. normalizeMatchup(final String matchup)
  7. normalizePackageNamePart(String name)
  8. normalizeRepositoryName(String input)
  9. normalizeSearchString(String src)