strip delete downcase upcase encode reverse
strip! delete! downcase! upcase! encode! reverse!中には、破壊的メソッドが用意されていないものもあります。例えばinsertは、なぜかinsert!はありません。またsizeのようにテキストの情報を取得するためのものはそもそもテキストを書き換えるわけではないので破壊的メソッドは不要でしょう。
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
str = "Welcome to Ruby!" puts("reverse: " + str.reverse) puts("upcase: " + str.upcase) str2 = "Welcome to Ruby!" puts("reverse: " + str2.reverse!) puts("upcase: " + str2.upcase!)
<< 前へ | 次へ >> |