##把字符串分割成数组
NSArray *lab = [status.labels componentsSeparatedByString:@","];
##字符串倒序
NSArray* reversedArray = [[selectArr reverseObjectEnumerator] allObjects];
##字符串的比较
-(BOOL)isEqualToString:(NSString *)aString;
##是否包含前缀(以str开头)
- (BOOL)hasPrefix:(NSString *)str;
##是否包含后缀(以str结尾)
- (BOOL)hasSuffix:(NSString *)str;
##是否包含字符串
- (BOOL)containsString:(NSString *)str;
##字符串拼接
NSString *mmStr = [@"aa" stringByAppendingString:@"bb"];
NSString *ggStr = [NSString stringWithFormat:@"%@----%d",@"cc",3];
##字符串替换
NSString* s1=[self stringByReplacingOccurrencesOfString:@" " withString:@""];
##查找子串的位置和范围
NSRange ran = [@"abc" rangeOfString:@"b"];
##截取指定范围的字符串
- (NSString *)substringWithRange:(NSRange)range;
##字符串转化为基本数据
int dd = [@"3" intValue];
CGFloat ff = [@"3.14" floatValue];
NSMutableNSString
##追加字符串
NSMutableString *mutableString =[[NSMutableString alloc]initWithFormat:@"我是可变字符串"];
[mutableString appendString:@"--aa"];
[mutableString appendString:@"--bb"];
NSString 总结
https://www.jianshu.com/p/d3f343b71cc2
https://blog.csdn.net/neveraway1993/article/details/51434486
网友评论