首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏岑志军的专栏

    NSCharacterSet 简单用法

    转载来源 NSCharacterSet其实是许多字符或者数字或者符号的组合,在网络处理的时候会用到 NSMutableCharacterSet *base = [NSMutableCharacterSet lowercaseLetterCharacterSet]; //字母 NSCharacterSet *decimalDigit = [NSCharacterSet decimalDigitCharacterSet BOOL)isPureNumandCharacters:(NSString *)string { string = [string stringByTrimmingCharactersInSet:[NSCharacterSet

    42640发布于 2018-05-28
  • 来自专栏DannyHoo的专栏

    NSCharacterSet类在分割字符串中的应用

    https://blog.csdn.net/u010105969/article/details/47043073 NSCharacterSet * set = [NSCharacterSet arrayWithArray:arr2]; [array1 removeObject:@""]; [array1 removeObject:@""]; 上面是一个分割字符串的例子,这里用到了NSCharacterSet

    1.6K20发布于 2018-09-13
  • 来自专栏陈满iOS

    iOS开发小点·NSString过滤特定字符

    过滤特定字符 NSCharacterSet *filterSet = [NSCharacterSet characterSetWithCharactersInString:@"[]{}(#%-*+=_)

    1.3K20发布于 2018-10-25
  • 来自专栏岑志军的专栏

    iOS提取字符串

    YES; } } return NO; } 2、过滤特殊字符串 + (NSString *)isSpecialCharacter:(NSString *)str{ NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"@/:;()¥「」"、[]{}%-+=_\\|~<>$€^•'@$% ]; NSScanner *scanner = [NSScanner scannerWithString:originalString]; // 提取包含0-9和*#的字符串 NSCharacterSet *numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789*#"]; while (!

    1.3K30发布于 2018-05-28
  • 来自专栏全栈程序员必看

    字符串分割与拼接「建议收藏」

    ,则将NSArray转化为NSMutableArray NSArray * array2 = [ptr componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@", "]];//以字符串中的字符作为分割条件进行分割 《字符集合》 NSCharacterSet 这是个字符集合类 [NSCharacterSet characterSetWithCharactersInString:@", "]//把字符串转化为字符集合

    42810编辑于 2022-08-24
  • 来自专栏freesan44

    iOS中URL编码那些事

    方法2:(推荐) 使用到的API - (nullable NSString *)stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet p1=abc&p2=我是参数2"; NSCharacterSet *encodeUrlSet = [NSCharacterSet URLQueryAllowedCharacterSet]; NSString stringByAddingPercentEncodingWithAllowedCharacters用法 stringByAddingPercentEncodingWithAllowedCharacters接收NSCharacterSet 对象,几种常用的NSCharacterSet: URLFragmentAllowedCharacterSet "#%<>[\]^`{|} URLHostAllowedCharacterSet

    2.9K20发布于 2018-09-05
  • 来自专栏iOS开发~

    iOS_调起各个地图软件

    =0&style=2", toCoor.latitude, toCoor.longitude] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet toCoor.latitude, toCoor.longitude, targetName] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet 1&policy=0", toCoor.latitude, toCoor.longitude] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet targetName, toCoor.latitude, toCoor.longitude] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet

    52310编辑于 2022-07-20
  • 来自专栏日常技术分享

    iOS富文本之数字小角标

    initWithString:text.uppercaseString]; NSScanner *scanner = [NSScanner scannerWithString:text]; NSCharacterSet *numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; while (!

    86910发布于 2020-07-30
  • 来自专栏日常技术分享

    ios 跳转第三方App实现导航

    name=北京&mode=driving&coord_type=gcj02",lat,lng] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet %@&dev=0&style=2",@"导航功能",@"nav123456",lat,lng] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet directionsmode=driving",@"导航测试",@"nav123456",lat,lng] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet tocoord=%@,%@&to=终点&coord_type=1&policy=0",lat,lng] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet

    2.8K30发布于 2018-09-13
  • 来自专栏iOS开发随笔

    iOS NSString 去除空格和回车

    去除两端空格 NSString *temp = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet ]]; 去除两端空格和回车 NSString *text = [temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet

    2.2K30发布于 2018-07-04
  • 来自专栏网罗开发

    iOS UITextField 显示银行卡格式

    self.contentTextField) { // 4位分隔银行卡卡号 NSString *text = [textField text]; NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789\b"]; string =

    1.1K20发布于 2021-01-29
  • 来自专栏Rindew的iOS技术分享

    iOS去除特殊字符

    *)text { NSString *strResult = nil; NSMutableString *originString = [text mutableCopy]; NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"~!

    4.2K30发布于 2019-05-17
  • 来自专栏日常技术分享

    iOS输入一个字符串,判断这个字符串是否是有效的IP地址

    val] && [scan isAtEnd]; } //是否只含有数字 + (BOOL)validateNumber:(NSString*)number { BOOL res = YES; NSCharacterSet * tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; int i = 0; while (i

    1.2K10发布于 2020-06-16
  • 来自专栏mukekeheart的iOS之旅

    OC基础--字符串

    NSLocale *)locale; //////////搜索字符集合////////// //12.搜索(指定字符集合) - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)searchSet; //13.搜索(指定字符集合,条件) - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)searchSet options :(NSStringCompareOptions)mask; //14.搜索(指定字符集合,条件,范围) - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet D, E, F) //分割(指定字符集合) NSArray *resultArr2 = [string componentsSeparatedByCharactersInSet:[NSCharacterSet af"; //////////修剪////////// NSString *result1 = [string stringByTrimmingCharactersInSet:[NSCharacterSet

    1.2K40发布于 2020-09-07
  • 来自专栏娱乐心理测试

    UITextField 常用方法实例

    NSRange)range replacementString:(NSString *)string { NSString *text = [textField text]; NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789\b"]; string =

    65540发布于 2019-05-26
  • 来自专栏韦弦的偶尔分享

    WKWebView 加载 Uni-App 导出的本地 H5

    id=%@",@"testId"] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet [[NSString stringWithFormat:@"file://%@",path] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet

    1.5K30编辑于 2022-09-21
  • 来自专栏日常技术分享

    iOS UITextField 限制输入

    验证格式 @return BOOL */ - (BOOL)inputTypeVerification:(NSString *)aStr format:(NSString *)format{ NSCharacterSet * filterCS = [[NSCharacterSet characterSetWithCharactersInString:format] invertedSet]; NSString *

    1.5K10发布于 2019-01-28
  • 来自专栏iOS逆向与安全

    iOS小技能:提取数字(文本框对粘贴内容进行手机号码提取)

    里的字符都找出来(包含去空格功能)替换成"" truePhone = [[truePhone componentsSeparatedByCharactersInSet:[[NSCharacterSet if(self.model.isgetPhone){ textField.text = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet textField.text = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet

    1.6K50编辑于 2022-08-22
  • 来自专栏iOS开发笔记

    iOS开发+(nullable instancetype)URLWithString:(NSString *)URLString

    NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet

    95670发布于 2019-05-15
  • 来自专栏编程之旅

    iOS开发——大大节省代码量的小技巧

    似乎只能去除头尾的特殊字符(不准) + (NSString *)filterSpecialWithString:(NSString *)string { // 定义一个特殊字符的集合 NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString: @ "@/:;: ;()? + (BOOL)checkIdentityCardNo:(NSString*)value { value = [value stringByTrimmingCharactersInSet:[NSCharacterSet

    60640发布于 2018-08-30
领券