I am new in IOS development.I am getting phone numbers in NSArray and this is something like this.
9429564999,
9428889239,
7878817072,
"+919408524477",
9909951666,
9879824567,
"+91 8469-727523",
"94-28-037780",
"+918460814614",
55246,
"8866-030880",
"95-37-223347",
"+919574777070",
"+917405750526",
Now i want to remove - and +91 from NSArray List not whole object.How to do this Please someone help
NSArray *phoneNoList = [[NSArray alloc]initWithObjects:@"9429564999",@"9428889239",@"7878817072",@"+919408524477",@"9909951666",@"9879824567", @"+91 8469-727523",@"94-28-037780",@"+918460814614",@"55246",@"8866-030880",@"95-37-223347",@"+919574777070", @"+917405750526", nil];
NSMutableArray *noArr = [[NSMutableArray alloc]init];
for (NSString *no in phoneNoList) {
NSString *temp1 = [[no componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]
componentsJoinedByString:@""];
if (temp1.length > 10) {
NSString *temp=[temp1 substringFromIndex:2];
[noArr addObject:temp];
}
else
[noArr addObject:temp1];
}
NSLog(@"Arr Data : %@",noArr);
Try this, definitely helps to you.