美文网首页
根据某一个字符截取字符串的某一段,获取前一段,获取后一段,给两个

根据某一个字符截取字符串的某一段,获取前一段,获取后一段,给两个

作者: 高乔人 | 来源:发表于2017-07-31 11:53 被阅读12次

XWCountryCodeController *CountryCodeVC = [[XWCountryCodeController alloc] init];

//block

[CountryCodeVC toReturnCountryCode:^(NSString *countryCodeStr) {

//[self.countryCodeLB setText:countryCodeStr];

NSArray *array =  [countryCodeStr componentsSeparatedByString:@"+"];

[self.topBtn setTitle:array[0] forState:UIControlStateNormal];

NSRange range = [countryCodeStr rangeOfString:@"+"];

NSString *str2 = [countryCodeStr substringFromIndex:range.location];

[self.numberLabel setText:str2];

}];

相关文章

网友评论

      本文标题:根据某一个字符截取字符串的某一段,获取前一段,获取后一段,给两个

      本文链接:https://www.haomeiwen.com/subject/ghnllxtx.html