zoukankan      html  css  js  c++  java
  • 字符串搜索

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

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

                                do {

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

                                    if (range.length > 0) {

                                     //这里就可以拿到range了  设置一个数据保存就可以 或者 做其他操作 比如替换成C

                                        [A replaceCharactersInRange:range withString:C];

                                        locationBegin += range.length + range.location;

                                    }else{

                                        break;

                                    }

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

  • 相关阅读:
    java多线程编程(一)
    java的本地文件操作
    Java基础总结(二)
    Gym 100851 Distance on Triangulation
    Gym 100851 题解
    Gym 101482 题解
    CodeForces Round 521 div3
    zoj 5823 Soldier Game 2018 青岛 I
    CodeForces round 520 div2
    CodeForces 1042 F Leaf Sets 贪心
  • 原文地址:https://www.cnblogs.com/PhenixWang/p/4290183.html
Copyright © 2011-2022 走看看