string＃计数选项

`String#count`的文档中我明白了第一个例子，但是我不明白其余的例子：

` `a = "hello world" a.count "lo" #=> 5 a.count "lo", "o" #=> 2 a.count "hello", "^l" #=> 4 a.count "ej-m" #=> 4` `

` `s="this is a string with is thrice" s.scan(/is/).count # => 3` `

`count([other_str]+) → fixnum`

` `a = "hello world" a.count "lo" #=> finds 5 instances of either "l" or "o" a.count "lo", "o" #=> the intersection of "lo" and "o" is "o", so it finds 2 instances a.count "hello", "^l" #=> the intersection of "hello" and "everything that is not "l" finds 4 instances of either "h", "e" or "o" a.count "ej-m" #=> finds 4 instances of "e", "j", "k", "l" or "m" (the "jm" part)` `

` `a = "hello world"` `
1. 计算字母`l``o`的出现次数

`a.count "lo" #=> 5`

2. find`lo``o`的相交点（这是计算`l``o`的出现次数，并且只从出现次数开始）：

`a.count "lo", "o" #=> 2`

3. 计算`h``e``l``l``o`的出现次数，然后与任何不是`l`相交（产生相同的结果来找出`h``e``o`出现次数）

`a.count "hello", "^l" #=> 4`

4. 计算`j``m``j``k``l``m` ）之间的`e`和任何字母的出现次数：

`a.count "ej-m" #=> 4`

` `a = "hello world" a.count "lo" # lo => 5 a.count "lo", "o" # o => 2` `

`^`可用于否定（所有字母在`hello` ，除了`l`

` `a.count "hello", "^l" # heo => 4` `

` `a.count "ej-m" # ejklm => 4` `