2011-09-22 指定した長さの文字列を生成する ruby tips 10.times.inject("") {|str| str << "a" }.size # 10 "".center(10, "a").size # 10 ("a" * 10).size # 10