ios手机号码验证

IOS手机号码验证 现在很多app软件注册的方式都采用手机号码注册,手机号码毫无疑问都是有数字组成的。为了避免用户输入错误的手机号码,所以我们要做手机号码的验证。手机号码的验证其实还是非常简单的,采用正则表达式就行了。 立即下载

//验证手机号

- (BOOL)validateMobile:(NSString *)mobileNum

{

   /**

     * 手机号码

     * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188

     * 联通:130,131,132,152,155,156,185,186

     * 电信:133,1349,153,180,189

     */

    NSString * MOBILE =@"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";

   /**

     10         * 中国移动:China Mobile

     11         * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188

     12         */

    NSString * CM =@"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$";

   /**

     15         * 中国联通:China Unicom

     16         * 130,131,132,152,155,156,185,186

     17         */

    NSString * CU =@"^1(3[0-2]|5[256]|8[56])\\d{8}$";

   /**

     20         * 中国电信:China Telecom

     21         * 133,1349,153,180,189

     22         */

    //    NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$";

    //    /**

    //     25         * 大陆地区固话及小灵通

    //     26         * 区号:010,020,021,022,023,024,025,027,028,029

    //     27         * 号码:七位或八位

    //     28         */

    //    // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";

    

   NSPredicate *regextestmobile = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", MOBILE];

   NSPredicate *regextestcm = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", CM];

   NSPredicate *regextestcu = [NSPredicatepredicateWithFormat:@"SELF MATCHES %@", CU];

    //    NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];

    

   if (([regextestmobile evaluateWithObject:mobileNum] == YES)

        || ([regextestcmevaluateWithObject:mobileNum] == YES)

        //        || ([regextestct evaluateWithObject:mobileNum] == YES)

        || ([regextestcuevaluateWithObject:mobileNum] == YES))

    {

       return YES;

    }

   else

    {

       return NO;

    }

}

iOS验证手机号的正则表达式 本文实例为大家分享了iOS正则验证手机号的代码片段,供大家参考,具体内容如下 //判断手机号码格式是否正确 + (BOOL)valiMobile:(NSString *)mobile { mobile = [mobile stringByReplacingOccurrencesOfString:@ withString:@]; if (mobile.length != 11) { return NO; }else{ /** * 移动号段正则表达式 */ NSString *CM_NUM = @^((13[4-9])|(14 立即下载

相关推荐

iOS 正则表达式判断手机号码、固话

话不多说,请看代码: { if (mobileNum.length != 11) { return NO; } /** * 手机号码: * 13[0-9], 14[5,7], 15[0, 1, 2, 3, 5, 6, 7, 8, 9], 17[6, 7, 8], 18[0-9], 170[0-9] * 移动号段: 134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705 * 联通号段: 130,131,132,155,156,185,186,

iOS 手机号码验证

手机号码验证

sammyieveo的专栏 1502

BrainVision Recorder 和 BrainVision Analyzer 2.2 安装

本篇为《EEG处理》系列博客的第二篇,该系列博客主要记录EEG信号处理的学习过程中的软件安装和学习过程,方便以后查阅。本篇为BrainVision Recorder 和 BrainVision Analyzer 2.2 的安装过程。 BrainVision Recorder 和 BrainVision Analyzer 2.2 安装安装前奏Brain Vision Analyzer分析软件 安装Brain Vision Recorder记录软件 安装推荐几款个人使用的科研软件 安装前奏 Brain V

梁小憨憨的博客 5064

在ios上,数字大于等于7位数就会自动被识别为电话号码问题

上面有颜色的数字是在ios上大于等于7位数的数字,会被自动识别为电话号码并且改变颜色,就算是使用**!important**也没用。白色是正常情况。 解决这个问题是在head里加一个meta,就可以 <meta name="format-detection" content="telephone=no" /> ...

空&白的博客 1268

第8章 Stata主成分分析与因子分析

在进行数据统计分析时,还往往会遇见变量特别多的情况,而且很多时候这些变量之间还存在着很强的相关关系或者说变量之间存在着很强的信息重叠,如果我们直接对数据进行分析,一方面会带来工作量的无畏的加大,另一方面还会出现一些模型应用的错误,于是主成分分析与因子分析应运而生。这两种分析方法的基本思想都是在不损失大量信息的前提下,利用较少的独立变量来替代原来的变量进行进一步的分析。 8.1主成分分析 基本思想是将众多的初始变量整合成少数几个互相无关的主成分变量,而这些新变量尽可能地包含...

qq_45112156的博客 5万+

新手必看:SMIC 0.18um PDK安装保姆级教程(附Cadence IC617环境配置)

本文提供SMIC 0.18um PDK在Cadence IC617环境下的详细安装教程,涵盖环境准备、文件解压、安装脚本运行、环境变量配置及Cadence集成验证等关键步骤,特别针对初学者常见问题提供解决方案,助力快速掌握芯片设计工具配置。

weixin_30522183的博客 492

1分钟教你实现iOS国际化

1分钟教你实现iOS国际化   作者 ruiying 关注 2016.11.30 19:07 字数 1026 阅读 318评论 2喜欢 16 官方文档: (https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/Introductio

lucasjunjie的博客 355

【WILEY】wiley期刊投稿详解:从revision到Accepted全流程实例讲解

注意:包括没标注修改位置的word文件和标注了修改位置的word文件。

Everyday try to become better -Kobe Bryant 1万+

iOS-正则表达式:手机号码校验

/** * 功能:校验手机号码 */ - (BOOL)validateMobile:(NSString *)mobileNumber { /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188,183,184,178 * 联通:130,131,132,152

mickeyYB_520的博客 672

从零到一:3D-ResNet50在医学影像中的实战陷阱与避坑指南

本文深入探讨了3D-ResNet50在医学影像分类中的实战应用,重点解析了NIFTI数据预处理、小样本迁移学习陷阱及GPU显存优化等关键问题。通过分块加载、混合精度训练等技巧,有效解决了医学影像处理中的内存管理和性能挑战,为开发者提供了实用的避坑指南和优化策略。

weixin_29038345的博客 391

抖音风控参数逆向实战:从bd-ticket-guard-client-data到x-tt-session-dtrait的完整攻防解析

本文深入解析抖音风控参数逆向实战,重点剖析bd-ticket-guard-client-data和x-tt-session-dtrait的生成机制与破解方法。通过抓包调试、ECDH密钥生成、RSA与AES双层加密等技术手段,揭示抖音风控系统的核心逻辑,并提供实用的对抗策略与维护建议,助力开发者突破抖音风控限制。

weixin_30335575的博客 677

iOS各种号码验证的正则表达式

1.手机号判断,根据维基百科2016年6月修订的段号判断 是否是手机号 /** 手机号码 13[0-9],14[5|7|9],15[0-3],15[5-9],17[0|1|3|5|6|8],18[0-9] 移动:134[0-8],13[5-9],147,15[0-2],15[7-9],178,18[2-4],18[7-8] 联通:13[0-2],145,15[5-6],17[5-6],18[5

bowei1105的博客 1402

【张量分解(二)】CP分解

一、CP分解 1.1 定义 CP分解就是将一个张量分解成多个单秩张量的和。例如,给定一个三阶张量X∈RI×J×K\mathcal{X}\in\mathbb{R}^{I\times J\times K}X∈RI×J×K,则CP分解可以写为 X≈∑r=1Rar∘br∘cr\mathcal{X}\approx\sum_{r=1}^{R}\textbf{a}_r\circ\textbf{b}_r\circ...

bqw的博客 2万+

ios 手机号码验证

- (BOOL)isMobileNumber:(NSString*)mobileNum {        /**         * 手机号码         * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188         * 联通:130,131,132,152,15

vienna_zj的专栏 2047

在 ABAP 平台配置 OAuth 2.0 Client(OA2C_CONFIG):一份可落地的全景实践

本文详细介绍了在ABAP平台中配置OAuth 2.0客户端的完整流程。重点讲解了四种授权类型(Client Credentials、Authorization Code、SAML 2.0 Bearer Assertion、Resource Owner Password Credentials)的适用场景和配置要点,以及客户端认证的三种方式(Client Secret、Client Certificate、mTLS)。文章提供了操作步骤、排错建议和工程实践指导,包括端点配置、回调地址管理、scopes设置等关

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 355

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

iOS 正则验证手机号码

Java代码   - (BOOL)validateMobile:(NSString *)mobileNum   {       /**       * 手机号码       * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188       * 联通:130,131,132,152,155,156,

yrx1004的专栏 665

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

iOS验证手机号码

验证手机号码的正确性 //验证手机号 - (BOOL)isMobileNumber:(NSString *)mobileNum { if ([mobileNum length] == 0) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"提

暮春三月,江南草长,杂花生树,群莺乱飞。 882

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

iOS 手机号码和邮箱的验证

/*手机号码验证 MODIFIED BY HELENSONG*/ +(BOOL) isValidateMobile:(NSString *)mobile {     //手机号以13, 15,18开头,八个 \d 数字字符     NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";

Jason_jason_yz的博客 703

Ios使用正则表达式验证手机号码

// 正则判断手机号码地址格式 - (BOOL)isMobileNumber:(NSString *)mobileNum {          //    电信号段:133/153/180/181/189/177     //    联通号段:130/131/132/155/156/185/186/145/176     //    移动号段:134/13

wzz_580640的博客 389

iOS 手机号码 身份证号码验证

手机号码验证+ (BOOL) isMobile:(NSString *)mobileNumbel{ /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 * 联通:130,131,132,152,155,156,185,186 * 电信:133,134

文兄的每日一博 499

正则表达式验证手机号码 iOS

#import @interfaceUtils : NSObject #pragma 正则匹配手机号 + (BOOL)checkTelNumber:(NSString*) telNumber; #pragma 正则匹配用户密码6-18位数字和字母组合 + (BOOL)checkPassword:(NSString*) password; #pragma 正则匹配用户姓名,20位的中文

yyacheng的博客 430

iOS最新验证电话号码与手机号码的正则方法

+ (BOOL)validateContactNumber:(NSString *)mobileNum{ /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 * 联通:130,131,132,152,155,156,185,186 * 电信:133,13

dongzhensong的博客 1万+

手机号码正则验证(试用版)

手机号码正则验证(试用版),拿来测试用的,不清楚现在还有些那些限制

无极的专栏 540
上一篇: 图片下载的两种方式
下一篇: 自己写的网络数据请求 第三方框架 断点续传 上传下载
LWZDeveloper
博客等级 码龄12年 4粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值