2012-02-07から1日間の記事一覧
『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 "…
『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 "…