Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I want to split the string like FG12344 in to FG and 12344 using Objective C. I don't how to do this, please help me in this issue?

like image 395
Vignesh Babu Avatar asked Dec 09 '22 08:12

Vignesh Babu


1 Answers

For the characters:

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

For the numbers:

NSString *numbers = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet letterCharacterSet]];
like image 186
Ruben Marin Avatar answered May 20 '23 04:05

Ruben Marin