技術メモ

主にRuby関連

2012-02-07から1日間の記事一覧

Cool!!な回答集 in 「rubeque」 (http://www.rubeque.com/)

『Rubeque』で Cool!! だったから score += 1 した回答集 正規表現がCool!! # 19 Separating Numbers with Commas def separate_with_comma(n) n.to_s.gsub(/(?<=\d)(?=(\d{3})+$)/,',') end # assert_equal "1", p separate_with_comma(1) # assert_equal "…