使用lowercaseString,uppercaseString -(void)test{ NSString * str = @"person"; NSString * str1 = [str lowercaseString]; NSString * str2 = [str uppercaseSt ...
使用lowercaseString,uppercaseString
-(void)test{
NSString * str = @"person";
NSString * str1 = [str lowercaseString];
NSString * str2 = [str uppercaseString];
NSLog(@"%@,%@",str1,str2);
NSString * text = @"Hello World";
text = [text stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:[[text substringToIndex:1]lowercaseString ]];
NSLog(@"text:%@",text);
}
列印結果:
2016-07-29 11:49:47.455 改變字母大小寫[1058:50425] str1:person
2016-07-29 11:49:47.455 改變字母大小寫[1058:50425] str2:PERSON
2016-07-29 11:49:47.456 改變字母大小寫[1058:50425] text:hello World