由网友(老子輝煌之時就是你避難時)分享简介:有没有人能够确定哪些算法用于包括哪些内容?方法在Ruby中?例如HelloWorld的.INCLUDE?(你好)解决方案 作为的压花的在他的回答状态,字符串#包括电话 rb_str_index 。反过来这个函数调用 rb_memsearch ,它实现了拉宾-Karp字符串搜索算法,根据这个帖子对红宝石论坛.COM 。I...
有没有人能够确定哪些算法用于包括哪些内容?方法在Ruby中?例如
HelloWorld的.INCLUDE?(你好)
解决方案
作为的压花的在他的回答状态,字符串#包括
电话 rb_str_index
。反过来这个函数调用 rb_memsearch
,它实现了拉宾-Karp字符串搜索算法,根据这个帖子对红宝石论坛.COM
。
Is anyone able to pinpoint which algorithm is used for the include? method in Ruby? For example
"helloworld".include?("hello")
解决方案
As emboss states in his answer, String#include
calls rb_str_index
. This function in turn calls rb_memsearch
, which implements the Rabin-Karp string search algorithm, according to this post on ruby-forum.com
.
相关推荐
最新文章