API 用于 C++ 中的 KMP 或 Boyer-Moore 字符串模式匹配/STL?
想知道,如果我想用更好的字符串匹配算法(例如 KMP 或 Boyer Moore)替换 strstr,C++ 中有吗?还是我们必须自己编写?
想知道除了strstr之外大家都用的实用的字符串匹配函数是什么?
这是针对 Unix/Linux 平台下的 C++/STL 而言的。
Wondering, if I want to replace strstr with a better string matching algorithm, like KMP or Boyer Moore, is there one in C++ or do we have to write on our own?
Wondering, what is the practical string matching function that everyone uses other than strstr?
This is with respect to C++/STL under Unix/Linux platform.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有看到很多使用特定于 C++ 的功能,但是有相当多的 KMP 实现和(特别是)Boyer-Moore 的变体(例如 Boyer-Moore-Horspool) 周围可以轻松地从 C++ 中使用。
I haven't seen many that use features specific to C++, but there are quite a few implementations of KMP and (especially) variants of Boyer-Moore (e.g., Boyer-Moore-Horspool) around that are easily usable from C++.