るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.036秒)
トップページ > クエリ:String[x] > クエリ:prefixes[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. string gsub!

クラス

検索結果

String#start_with?(*prefixes) -> bool (21173.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...f の先頭が prefixes のいずれかであるとき true を返します。

@param prefixes パターンを表す文字列または正規表現 (のリスト)

//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?...
...("ing", "str") # => true
"string".start_with?(/\w/) # => true
"string".start_with?(/\d/) # => false
//}

@see String#end_with?
@see String#delete_prefix, String#delete_prefix!...

Symbol#start_with?(*prefixes) -> bool (137.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...self の先頭が prefixes のいずれかであるとき true を返します。

(self.to_s.start_with?と同じです。)

@param prefixes パターンを表す文字列または正規表現 (のリスト)

@see Symbol#end_with?

@see String#start_with?

//emlist[][ruby]{
:hello.start_with?("hel...
...l") #=> true
:hello.start_with?(/H/i) #=> true

# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}...