Android Chinese String Length Get getChineseLength(String value)

Here you can find the source of getChineseLength(String value)

Description

get Chinese Length

Declaration

public static int getChineseLength(String value) 

Method Source Code

//package com.java2s;

public class Main {
    public static int getChineseLength(String value) {
        int valueLength = 0;
        String chinese = "[\u0391-\uFFE5]";
        for (int i = 0; i < value.length(); i++) {
            String temp = value.substring(i, i + 1);
            if (temp.matches(chinese)) {
                valueLength += 1;/*from  w ww.  jav  a2  s  .  c  o m*/
            }
        }
        return valueLength;
    }
}