一,效果图。
images/loading.gif' data-original="http://images2015.cnblogs.com/blog/337518/201510/337518-20151020151639192-707434923.jpg" width="218" height="400" />
二,代码。
RootViewController.m
- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. //电话号码 UILabel *telLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 200, 20)]; telLabel.textColor = [UIColor grayColor]; telLabel.text = @"13793333281"; //字符串的截取 NSString *string = [telLabel.text substringWithRange:NSMakeRange(4,4)]; //字符串的替换 telLabel.text = [telLabel.text stringByReplacingOccurrencesOfString:string withString:@"----"]; [self.view addSubview:telLabel];}
原标题:【代码笔记】替换电话号码中间4位为
关键词: