zoukankan      html  css  js  c++  java
  • java判断姓是否合格 百家姓

    package util;
    
    import java.lang.reflect.Array;
    
    public class FirstName {
        
        public static boolean ClearName(String name){
            String[] surName = {
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","羿",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","宿","","怀","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "寿","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","广","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","","","","","","","","","",
                    "","",
                    "万俟","司马","上官","欧阳","夏侯",
                    "诸葛","闻人","东方","赫连","皇甫",
                    "尉迟","公羊","澹台","公冶","宗政",
                    "濮阳","淳于","单于","太叔","申屠",
                    "公孙","仲孙","轩辕","令狐","锺离",
                    "宇文","长孙","慕容","鲜于","闾丘",
                    "司徒","司空","丌官","司寇","南宫",
                    "子车","颛孙","端木","巫马","公西",
                    "漆雕","乐正","壤驷","公良","拓拔",
                    "夹谷","宰父","谷梁","段干","百里",
                    "东郭","南门","呼延","羊舌","微生",
                    "梁丘","左丘","东门","西门"
                    }; 
            
            String firstName = name.substring(0,1);
            for(String s : surName){
                String s1 = s.substring(0,1);
                if(s.contains(firstName)){
                    return true;
                }
            }
            return false;
            
        }
        public static void main(String[] args) {
            String name = "张三";
            System.out.println(ClearName(name));
        }
    }
  • 相关阅读:
    集合的一些操作总结
    字符串的操作
    python字典的操作总结
    python中的列表知识总结
    Python利用文件操作实现用户名的存储登入操作
    如何理解:城市的“信息化→智能化→智慧化”
    程序员必备技能-怎样快速接手一个项目
    程序员的职业规划
    只要 8 个步骤,学会这个 Docker 命令终极教程!
    使用GitLab实现CI/CD
  • 原文地址:https://www.cnblogs.com/tnsay/p/5892721.html
Copyright © 2011-2022 走看看