Get Chinese Number - Android Internationalization

Android examples for Internationalization:Chinese

Description

Get Chinese Number

Demo Code

public class Main{
    private final static String[] CHINA_NUMBER = { "yi", "er", "san",
            "si", "wu", "liu", "qi", "ba", "jiu", "shi" };
    public static String getChineseNumber(int i) {
        if (i == 10) {
            return CHINA_NUMBER[9];
        }//  w  w  w. j  ava  2s  . c o m
        String value = String.valueOf(i);
        char[] array = value.toCharArray();
        value = "";
        for (char c : array) {
            value += CHINA_NUMBER[Integer.parseInt(String.valueOf(c)) - 1];
        }
        return value;
    }

}

Related Tutorials