※初めての投稿ですm(__)m
文字列の定義
文字列(String)の指定はダブルクオーテーション("")で文字列を囲うことで定義出来ます。
sample.rb
変数 = "文字列"
分割する
split(文字列の分割)
sample.rb
string = "pockemon, ruby, pikachu"
p string.split(",")
=> ["pockemon", " ruby", " pikachu"]
変換する
capitalize, capitalize!(先頭の文字を大文字に変換する)
sample.rb
string = "poCkemon, pikachU"
p string.capitalize
=> "Pockemon, pikachu"
reverse, reverse!(文字列を反転する)
sample.rb
string = "pockemon"
p string.reverse
=> "nomekcop"
downcase, downcase!(大文字を小文字に変換する)
sample.rb
string = "POCKEMON, pikachU"
p string.downcase
=> "pockemon, pikachu"
upcase, upcase!(小文字を大文字に変換する)
sample.rb
string = "pockemon, pikachu"
p string.upcase
=> "POCKEMON, PIKACHU"