Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Stringクラス > prepend
prepend(other_str) -> String
[permalink][rdoc]文字列 other_str を先頭に破壊的に追加します。
a = "world"
a.prepend("hello ") # => "hello world"
a # => "hello world"
prepend(*arguments) -> String
[permalink][rdoc]複数の文字列を先頭に破壊的に追加します。
a = "!!!"
a.prepend # => "!!!"
a # => "!!!"
a = "!!!"
a.prepend "hello ", "world" # => "hello world!!!"
a # => "hello world!!!"