2017-01-09から1日間の記事一覧

Rubyメソッド

分割して 整数にして 格納 # "1 2 3" l, m, n = gets.chomp.split.map(&:to_i); puts l,m,n # 1 # 2 # 3 split x = "hello world" #=> "hello world" p x.split #=> ["hello","world"] http://ref.xaio.jp/ruby/classes/string/split