|
|
||
http://rubyist.g.hatena.ne.jp/krystal/20081128/1227867175
正規表現でやるごり押し感なのが好きだけど、でも思いついたのはこれ。
def num2astrisk(n) counter = "0" result = "" while counter != n result << "*" counter.succ! end result end
holysugar2008/12/02 12:27succ できるなら Range 作れるよなあ。勉強になります。("1"..n).map{"*"}.join でいいね。