我不明白为什么 include?
在这两种情况下都返回 true
。谁能赐教一下?
"".include?("") # => true
"stackoverflow".include?("") # => true
include? other_str → true or false
Returns true if str contains the given string or character.
最佳答案
因为字符串“stackoverflow”在字母/字符之间包含无限数量的空字符串。
关于ruby - string.include 的奇怪行为?在 ruby ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19583213/