is Chinese by Regex - Java Internationalization

Java examples for Internationalization:Chinese

Description

is Chinese by Regex

Demo Code


//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    private static Pattern PATTERN_CHINESE = Pattern
            .compile("^[\\u4E00-\\u9FA5]+$");

    public static boolean isChinese(String chinese) {
        if (chinese == null)
            return false;
        else//  w w  w .j a v a  2s  .  co  m
            return PATTERN_CHINESE.matcher(chinese).matches();
    }
}

Related Tutorials