代码之家  ›  专栏  ›  技术社区  ›  ayush

c上的字符串筛选++

  •  2
  • ayush  · 技术社区  · 14 年前

    假设我把我的毒话排成一列

    char[][]={"...",".."...and more...}
    

    char str[]="......."
    

    任何能帮到我的图书馆功能。

    提前谢谢你的帮助

    1 回复  |  直到 14 年前
        1
  •  4
  •   Armen Tsirunyan    14 年前

    boost字符串算法

    string str1="Hello Dolly, Hello World!"
    replace_first(str1, "Dolly", "Jane"); // str1 == "Hello Jane, Hello World!"
    replace_last(str1, "Hello", "Goodbye"); // str1 == "Hello Jane, Goodbye World!"
    erase_all(str1, " "); // str1 == "HelloJane,GoodbyeWorld!"
    erase_head(str1, 6); // str1 == "Jane,GoodbyeWorld!"
    

    从下载boost here

    这个特定库的文档是 here (第5页是关于替换算法的)