"hello".delete "l","lo" #=> "heo" "hello".delete "lo" #=> "he" "hello".delete "aeiou", "^e" #=> "hell" "hello".delete "ej-m" #=> "ho"
Returns a copy of str with all characters in the intersection of its arguments deleted.
可以解释一下吗,谢谢,已谷歌。
2.英文不好,那么多翻译工具、网页也可以用,有什么看不懂的?
3.已谷歌,不知道你谷歌的啥,例如你不知道 puts 怎么用,这估计 google 也帮不了你了吧。。。
#1 楼 @catherine 不想答就不答嘛,我国社区总是针对人不针对问题。我搜了 stackoverflow,第三行和第四行没看懂。谷歌翻译我也用了,你自己看看出来的结果能看懂吗。你会的话,贴个链接或者简单几句说完不就行了,非得装老先生吐槽新手,有意思么。
不客气,我也不算老手,今年才毕业。
最开始学习,看到正则表达式我也不知道这是什么鬼,奇奇怪怪的符号放在一起。所以先尽量把文档的说明看懂,这一步很容易。再自己调试,尝试找规律来得出答案,这个过程后,就算有问题,你也差不多提取到这个问题困扰你的核心部分。不管是提问还是搜索,都更容易获得更准确的反馈。
#4 楼 @ajfg93 你这种心态,丝毫对不起给你回复的人。
要学会看全啊,还有一句,Uses the same rules for building the set of characters as String#count. http://ruby-doc.org/core-2.3.0/String.html#method-i-count
Each other_str parameter defines a set of characters to count. The intersection of these sets defines the characters to count in str. Any other_str that starts with a caret ^ is negated. The sequence c1-c2 means all characters between c1 and c2. The backslash character \ can be used to escape ^ or - and is otherwise ignored unless it appears at the end of a sequence or the end of a other_str.