且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何找到一个字符串是否以Ruby中的另一个字符串开头?

更新时间:2022-11-17 11:21:51

puts 'abcdefg'.start_with?('abc')  #=> true

[edit]这是我在问这个问题之前不知道的事情:start_with具有多个参数.

[edit] This is something I didn't know before this question: start_with takes multiple arguments.

'abcdefg'.start_with?( 'xyz', 'opq', 'ab')