NSString *string = @"hello, this is Andy yi!";
NSString *upperString = [string uppercaseStringWithLocale:[NSLocale currentLocale]];
NSLog(@"upperStr: %@", upperString);
NSString *capString = [upperString capitalizedStringWithLocale:[NSLocale currentLocale]];
NSLog(@"capStr: %@", capString);
NSString *lowerString = [capString lowercaseStringWithLocale:[NSLocale currentLocale]];
NSLog(@"lowerStr: %@", lowerString);
This is the result:
2012-11-15 09:52:48.232 SeperateImage[322:11303] upperStr: HELLO, THIS IS ANDY YI!
2012-11-15 09:52:48.234 SeperateImage[322:11303] capStr: Hello, This Is Andy Yi!
2012-11-15 09:52:48.235 SeperateImage[322:11303] lowerStr: hello, this is andy yi!
本文介绍如何使用Objective-C进行字符串操作,包括将字符串转换为大写、首字母大写及小写的方法,并展示了具体的代码实现过程。
1455

被折叠的 条评论
为什么被折叠?



