objective c - Filtering a NSMutableArray and returning only numbers -
i have nsmutablearray called mymutablearray inside him, have following values:
('r$ 118.98','ae 12.00 er','r$ 456.99')
what do, find way filter information contained within array, making returns numeric characters, example:
('118.98','12.00','456.99')
i have simple code lines inside array:
for(int x=0; x<[mymutablearray count]; x++){ mymutablearray[x];//we need find way filter , update informations store numbers. }
what code can put in code filter information inside array storing numbers?
try:
//create new mutable array store modified values nsmutablearray *arrfinal = [[nsmutablearray alloc] init]; //fast-enumerate within mymutablearray (nsstring *strcurrent in mymutablearray) { nsstring *strmodified = [strcurrent stringbytrimmingcharactersinset:[[nscharacterset decimaldigitcharacterset] invertedset]]; [arrfinal addobject:strmodified]; } nslog(@"%@",[arrfinal description]);
Comments
Post a Comment