[Feature #679] Integer#to_s(:step=>3, :sep=>",") が欲しい


#1

e$B%A%1%C%He(B #679 e$B$,99?7$5$l$^$7$?!#e(B (by Martin De$(D+de(Brst)

e$B:G=i$NNc$Oe(B 12,345,678 e$B$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$3$l$G$O%$%s%IIw$NI=5-$,IT2DG=$G$O$J$$$G$7$g$&$+e(B (1,23,45,678,
e$B$h$&$9$k$K0lHV1&$K$O;0$D!"$=$N:8$OFs$D$:$De(B)e$B!#e(B

Integer e$B$@$1$G$O$J$/!"B>$N?t$O$I$&$G$7$g$&$+!#e(B

http://redmine.ruby-lang.org/issues/show/679


#2

e$BF#2,$G$9!#e(B

e$B:G=i$NNc$Oe(B 12,345,678 e$B$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$"!#$=$&$G$7$?!#e(B

e$B$3$l$G$O%$%s%IIw$NI=5-$,IT2DG=$G$O$J$$$G$7$g$&$+e(B (1,23,45,678, e$B$h$&$9$k$K0lHV1&$K$O;0$D!"$=$N:8$OFs$D$:$De(B)e$B!#e(B

e$B%$%s%IIw$O9MN8$7$F$$$^$;$s!#e(Bsprintfe$B$b9MN8$7$F$$$^$;$s$7!#e(B

Integer e$B$@$1$G$O$J$/!"B>$N?t$O$I$&$G$7$g$&$+!#e(B

e$B@0?t$G$O$3$N5!G=$,$"$l$P$$$$$J$H$O;W$C$?$N$G$9$,!e(B
e$BIbF0>.?tE@?t$OI,MW$,$$k$N$G$7$g$&$+!#e(B
e$B$*$=$i$/6b3[$NI=8=$G$7$+;H$o$J$$$H;W$C$F$$$^$9!#e(B


#3

e$B@.@%$G$9!#e(B

e$B:G=i$NNc$Oe(B 12,345,678 e$B$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$3$l$G$O%$%s%IIw$NI=5-$,IT2DG=$G$O$J$$$G$7$g$&$+e(B
(1,23,45,678, e$B$h$&$9$k$K0lHV1&$K$O;0$D!"$=$N:8$OFs$D$:$De(B)e$B!#e(B

POSIX C e$B$N;EMM$r??;w$F!e(B
12345678.to_s(:step=>[3, 2, 0], :sep=>,") #=> 1,23,45,678
e$B$H$+e(B
12345678.to_s(:step=>320, :sep=>",") #=> 1,23,45,678
e$B$H$+e(B

e$B$"$H$O!"e(B:step e$B$h$je(B :grouping e$B$G$9$+$M$!#e(B


#4

e$B$5$/$G$9!#e(B

stepe$B$O0cOB46$,$"$k$N$G$9$,!"$+$H$$$C$Fe(Bgroup_widthe$B$G$OD9$$$G$9$M!D!De(B

The symbol for this is called the thousands separator or, more
generally (see India and China below), digit group separator
e$B$@$=$&$G$9!#e(B[wikipedia]

2008/10/23 16:45 Fujioka removed_email_address@domain.invalid:

e$B@0?t$G$O$3$N5!G=$,$"$l$P$$$$$J$H$O;W$C$?$N$G$9$,!e(B
e$BIbF0>.?tE@?t$OI,MW$,$$k$N$G$7$g$&$+!#e(B
e$B$*$=$i$/6b3[$NI=8=$G$7$+;H$o$J$$$H;W$C$F$$$^$9!#e(B

e$BJd=uDL2_C10L$r9MN8$9$l$P!"6b3[$NI=5-$K$b>.?t$O=P$F$-$^$9$M!#e(B