字符串搜索

在一个字符串A中搜索特定字符串Bspa

 NSInteger locationBegin = 0;//开始搜索字符串A字符串

                            do {it

                                NSRange range = [A rangeOfString:B options:NSCaseInsensitiveSearch range:NSMakeRange(locationBegin, A.length - locationBegin)];io

                                if (range.length > 0) {搜索

                                 //这里就能够拿到range了  设置一个数据保存就能够 或者 作其余操做 好比替换成Cim

                                    [A replaceCharactersInRange:range withString:C];数据

                                    locationBegin += range.length + range.location;img

                                }else{while

                                    break;字符

                                }

                            } while (locationBegin + imgStr.length <= A.length);

相关文章
相关标签/搜索