NSString *str=@"1,2,3,4";
[str stringByReplacingOccurrencesOfString:@"3," withString:@""];
That will remove ALL occurrences of @”3,” in str
.
If you want to remove only the first occurrence of @”3,”:
NSString* str = @"1,2,3,4";
NSRange replaceRange = [str rangeOfString:@"3,"];
if (replaceRange.location != NSNotFound){
NSString* result = [str stringByReplacingCharactersInRange:replaceRange withString:@""];
}
Hope this helps.