zoukankan      html  css  js  c++  java
  • 号码运营商判断

    private string[] YDPhone = { "134", "135", "136", "137", "138", "139", "147", "150", "151", "152", "157", "158", "159", "178", "182", " 183", " 184", "187", "188" };
    private string[] LTPhone = { "130", "131", "132", "145", "155", "156", "171", "175", "176", "185", "186" };
    private string[] DXPhone = { "133", "149", "153", "173", "177", "180", "181", "189" };
    private string[] VPHone = { "170" };


    #region 判断是否是移动号码
    /// <summary>
    /// 判断是否是移动号码
    /// </summary>
    /// <param name="phone">输入字符串</param>
    /// <returns></returns>
    protected bool IsYDPhone(string phone)
    {
    string phoneSub = phone.Substring(0, 3);
    if (Array.IndexOf<string>(YDPhone, phoneSub) == -1)
    {
    return false;
    }
    else
    {
    return true;//移动号码
    }
    }
    #endregion

    #region 判断是否是联通号码
    /// <summary>
    /// 判断是否是联通号码
    /// </summary>
    /// <param name="phone">输入字符串</param>
    /// <returns></returns>
    protected bool IsLTPhone(string phone)
    {
    string phoneSub = phone.Substring(0, 3);
    if (Array.IndexOf<string>(LTPhone, phoneSub) == -1)
    {
    return false;
    }
    else
    {
    return true;//联通号码
    }
    }
    #endregion

    #region 判断是否是电信号码
    /// <summary>
    /// 判断是否是电信号码
    /// </summary>
    /// <param name="phone">输入字符串</param>
    /// <returns></returns>
    protected bool IsDXPhone(string phone)
    {
    string phoneSub = phone.Substring(0, 3);
    if (Array.IndexOf<string>(DXPhone, phoneSub) == -1)
    {
    return false;
    }
    else
    {
    return true;//电信号码
    }
    }
    #endregion

    #region 判断是否是虚拟号码
    /// <summary>
    /// 判断是否是虚拟号码
    /// </summary>
    /// <param name="phone">输入字符串</param>
    /// <returns></returns>
    protected bool IsVPhone(string phone)
    {
    string phoneSub = phone.Substring(0, 3);
    if (Array.IndexOf<string>(VPHone, phoneSub) == -1)
    {
    return false;
    }
    else
    {
    return true;//虚拟号码
    }
    }
    #endregion

    本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/7874365.html

  • 相关阅读:
    Web_0012:FTP文件编辑器关联
    JS_0033:判断苹果安卓 微信浏览器,并在苹果微信浏览器下做特别处理
    JS_0032:匿名函数 function前加 ! 或 function用括号包裹起来 含义
    JS_0031:JS 常用方法
    spark为什么用scala语言开发
    spark开发常见问题
    java实现多继承
    数仓架构
    object类中的方法
    Spring的IOC原理
  • 原文地址:https://www.cnblogs.com/wugh8726254/p/7874365.html
Copyright © 2011-2022 走看看