ayu*_*ush 3 c++ string replace filter
给定 C++ 中的字符串文字,我必须通过 ### 删除诸如愚蠢等有害词。
假设我在一个数组中有我的有毒词
char[][]={"...",".."...and more...}
Run Code Online (Sandbox Code Playgroud)
我的字符串就像
char str[]="......."
Run Code Online (Sandbox Code Playgroud)
任何可以在这里帮助我的特定库函数。
提前感谢您的帮助
提升字符串算法
例子:
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!"
Run Code Online (Sandbox Code Playgroud)
从这里下载提升
这个特定库的文档在这里(第 5 页是关于替换算法)
| 归档时间: |
|
| 查看次数: |
2344 次 |
| 最近记录: |