For string, find and replace

前端 未结 6 964
盖世英雄少女心
盖世英雄少女心 2020-12-16 08:03

Finding some text and replacing it with new text within a C string can be a little trickier than expected. I am searching for an algorithm which is fast, and that has a smal

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 08:16

    Using std::string (from ) you can simply use find and replace.

    • http://www.cplusplus.com/reference/string/string/find/ - Gets you an index.
    • http://www.cplusplus.com/reference/string/string/replace/ - Takes an index.

    Edit: Touché. This is for C++ only.

    Is this any good to you? http://www.daniweb.com/forums/thread51976.html

提交回复
热议问题