com.zx.zxutils.util.ZXFormatCheckUtil类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.zx.zxutils.util.ZXFormatCheckUtil类的一些代码示例,展示了ZXFormatCheckUtil类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZXFormatCheckUtil类的具体详情如下:
包路径:com.zx.zxutils.util.ZXFormatCheckUtil
类名称:ZXFormatCheckUtil

ZXFormatCheckUtil介绍

[英]Created by Xiangb on 2017/6/30. 功能:格式检测工具类
[中]香波于2017年6月30日创建。功能:格式检测工具类

代码示例

代码示例来源:origin: StannyBing/ZXUtils

/**
 * 判断是否是银行卡号
 *
 * @param cardId
 * @return
 */
public static boolean isBankNum(String cardId) {
  char bit = getBankCardCheckCode(cardId
      .substring(0, cardId.length() - 1));
  if (bit == 'N') {
    return false;
  }
  return cardId.charAt(cardId.length() - 1) == bit;
}

代码示例来源:origin: StannyBing/ZXUtils

/**
 * 检测String是否全是中文
 *
 * @param name
 * @return
 */
public static boolean isAllChinese(String name) {
  boolean res = true;
  char[] cTemp = name.toCharArray();
  for (int i = 0; i < name.length(); i++) {
    if (!isChinese(cTemp[i])) {
      res = false;
      break;
    }
  }
  return res;
}

代码示例来源:origin: StannyBing/ZXUtils

@Override
public void onItemClick(int position) {
  switch (position) {
    case 0:
      showCheckInfo(ZXFormatCheckUtil.isPhoneNum("13984571000"));
      break;
    case 1:
      showCheckInfo(ZXFormatCheckUtil.isEmail("872349256@qq.com"));
      break;
    case 2:
      showCheckInfo(ZXFormatCheckUtil.isIdCardNum("121849249249217894"));
      break;
    case 3:
      showCheckInfo(ZXFormatCheckUtil.isBankNum("1564891564654146"));
      break;
    case 4:
      showCheckInfo(ZXFormatCheckUtil.isAllChinese("测试1测试"));
      break;
    default:
      break;
  }
}

代码示例来源:origin: StannyBing/ZXUtils

Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
if (isAllNum(Ai) == false) {
  errorInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
  Log.e("mvpInfo", "ID:" + "errorInfo=" + errorInfo);
String strMonth = Ai.substring(10, 12);// 月份
String strDay = Ai.substring(12, 14);// 月份
if (isDataFormat(strYear + "-" + strMonth + "-" + strDay) == false) {
  errorInfo = "身份证生日无效。";
  Log.e("mvpInfo", "ID:" + "errorInfo=" + errorInfo);
Hashtable h = GetAreaCode();
if (h.get(Ai.substring(0, 2)) == null) {
  errorInfo = "身份证地区编码错误。";

代码示例来源:origin: StannyBing/ZXUtils

/**
 * 检测是否包含中文
 *
 * @param name
 * @return
 */
public static boolean isContainsChinese(String name) {
  boolean res = false;
  char[] cTemp = name.toCharArray();
  for (int i = 0; i < name.length(); i++) {
    if (isChinese(cTemp[i])) {
      res = true;
      break;
    }
  }
  return res;
}

相关文章