开发者

How to split the numbers and characters in to two strings in objective c?

开发者 https://www.devze.com 2023-03-03 16:09 出处:网络
I want to split the string li开发者_JAVA百科ke FG12344 in to FG and 12344 using Objective C. I don\'t how to do this, please help me in this issue?For the characters:

I want to split the string li开发者_JAVA百科ke FG12344 in to FG and 12344 using Objective C. I don't how to do this, please help me in this issue?


For the characters:

NSString *characters = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]];

For the numbers:

NSString *numbers = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet letterCharacterSet]];


you can use NSPredicate for similar cases.

0

精彩评论

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