标签:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *str=@"180-234-140-22";
NSString *newStr=[str stringByReplacingOccurrencesOfString:@"-" withString:@""];
NSLog(@"str=%@",newStr);
大小写转换
NSString *str2=@"HelloWorld";
NSLog(@"大写转换%@",[str2 uppercaseString]);
NSLog(@"小写转换%@",[str2 lowercaseString]);
NSLog(@"首字母大写%@",[str2 capitalizedString]);
NSString *str1=@"pear",*str2=@"apple";
NSString *newstr=[[NSString alloc]initWithFormat:@"拼接后%@ %@",str1,str2];
NSString *newstr1=[str1 stringByAppendingString:str2];
NSString *newstr2=[str1 stringByAppendingFormat:@"-%@",str2];
NSLog(@"%@",newstr2);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/j-h-t-123-n/p/5116205.html