RubyMonk 高级字符串操作

标签 ruby string

我对来自 RubyMonk 的以下问题的回答有点困惑.

Let's find the second character in the string 'RubyMonk Is Pretty Brilliant' preceded by a space, which should be 'P'

'RubyMonk Is Pretty Brilliant'.match(/ ./, 9)

为什么我要在参数中放置一个“9”?

非常感谢您的解释。

最佳答案

和尚清楚地说

When the second parameter is present, it specifies the position in the string to begin the search.

关于RubyMonk 高级字符串操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29684857/

相关文章:

ruby - 使用 xpath 与 span 获取元素(一个适用于 IE 和 Firefox,但另一个仅适用于 IE)

javascript - 当客户从另一台计算机(使用 Rails)添加预订时,如何让页面显示预订更新?

string - excel中如何合并折线

javascript - 使用 JavaScript 突出显示网页上的每个单词,一次一个

mysql - 如何在 MySQL 数据库中存储电话号码?

ruby - 我无法从 nokogiri 节点内容中删除空格

ruby - 我如何从 `require' : no such file to load in ruby? 中拯救

ruby-on-rails - 选项.获取。我不明白

ruby - 在 Ruby 中捕获异常后重新引发(相同的异常)

c - 过滤掉字符串列表