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

C++中是否有等价的Strux替换?

  •  7
  • waiwai933  · 技术社区  · 14 年前

    str_replace 基本上做查找和替换的函数。在C++中有这个函数的等价物吗?

    3 回复  |  直到 14 年前
        1
  •  9
  •   Georg Fritzsche    14 年前

    Boost String Algorithms Library -在这种情况下 replace functions :

    std::string str("aabbaadd");    
    boost::algorithm::replace_all(str, "aa", "xx");
    

    str 现在包含 "xxbbxxdd" .

        2
  •  7
  •   Anthony Atmaram    12 年前

    std::string::replace 我可以做替换。你可以把它和 std::string::find* 方法来获得类似的功能。这并不像PHP那样简单。我认为Boost有你想要的东西;在里面 regular expressions .

        3
  •  0
  •   Mark Kahn    10 年前