Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static boolean isName(String s) {
        if (null == s || "".equals(s.trim()))
            return false;
        for (int i = 0; i < s.length(); i++) {
            if (!isChinese(s.charAt(i)) && !isEnglish(s.charAt(i)) && s.charAt(i) != ' '
                    && !".".equals(s.charAt(i)))
                return false;
        }
        return true;
    }

    public static boolean isChinese(char a) {
        int v = (int) a;
        return (v >= 19968 && v <= 171941);
    }

    public static boolean isEnglish(int word) {
        if (!(word >= 'A' && word <= 'Z') && !(word >= 'a' && word <= 'z')) {
            return false;
        }
        return true;
    }
}