package com.example.administrator.zhapp.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 判断文本类型的工具类
 */
public class TextType {

    /**
     * 输入的是数字
     *
     * @param text
     * @return
     */
    public static boolean isNum(String text) {
        Pattern p = Pattern.compile("[0-9]*");
        Matcher m = p.matcher(text);
        return m.matches();
    }

    /**
     * 输入的是汉字
     *
     * @param text
     * @return
     */
    public static boolean isText(String text) {
        Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
        Matcher m = p.matcher(text);
        return m.matches();
    }
}