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

  • 相关阅读:
    洛谷【P1109 学生分组】 题解
    卡特兰数
    并查集
    深度优先搜索DFS;递归
    【71】序列模型和注意力机制
    c/c++ 常用的几个安全函数
    win32 Ui 编程 收集
    vc获取特殊路径(SpecialFolder)
    std::map 自定义排序
    16-----BBS论坛
  • 原文地址:https://www.cnblogs.com/wugh8726254/p/7874365.html
Copyright © 2011-2022 走看看