开发者

How to make all characters lowercase in NSString?

开发者 https://www.devze.com 2023-04-02 10:51 出处:网络
How 开发者_开发知识库would I go about making all characters in an NSString lowercase?NSString has a cunningly named lowercaseString method.

How 开发者_开发知识库would I go about making all characters in an NSString lowercase?


NSString has a cunningly named lowercaseString method.

NSString *noCaps = [yourString lowercaseString];

Edited to add

If you are asking how to change the actual string to be lowercase - you can't. NSStrings are immutable. They can't be changed after they have been created. If you want to change the string in place you should use an NSMutableString like so:

[aMutableString setString:[aMutableString lowercaseString]];
0

精彩评论

暂无评论...
验证码 换一张
取 消