阿帕奇的StringUtils.contains和博耶 - 穆尔字符串搜索算法 [英] StringUtils.contains of Apache and Boyer–Moore string search algorithm

查看:295
本文介绍了阿帕奇的StringUtils.contains和博耶 - 穆尔字符串搜索算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要搜索S在S(尺码(S)> =大小(S),并返回一个真/假值),这是更好的性能,使用的Apache StringUtils.contains()或使用博耶 - 穆尔算法实现,有人我发现测试呢?

To search for s in S (size(S) >= size(s) and return a true/false value), it's better for performance to use StringUtils.contains() of Apache or use Boyer-Moore algorithm implemented and tested well by someone I found?

感谢

推荐答案

在我最后一次看到Java的正则表达式匹配code,而调试,Java 7的正则表达式引擎所使用的博耶 - 穆尔算法文字文本序列匹配。所以,最简单的方法来找到字符串使用博耶 - 穆尔是prepare使用 P = Pattern.compile(searchString,Pattern.LITERAL) 和搜索使用 p.matcher(toSearchOn).find()。没有第三方库和不需要手工工作。我相信JRE类测试,以及...

The last time I looked into the Java regex matching code while debugging, the Java 7 regex engine used the Boyer-Moore algorithm for sequences of literal text matches. So the easiest way to find a String using Boyer-Moore is to prepare using p=Pattern.compile(searchString, Pattern.LITERAL) and search using p.matcher(toSearchOn).find(). No third party libraries and no handcrafted work needed. And I believe the JRE classes are tested well…

这篇关于阿帕奇的StringUtils.contains和博耶 - 穆尔字符串搜索算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆