Project

General

Profile

Actions

Feature #679

closed

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

Added by xibbar (Takeyuki FUJIOKA) over 15 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:

Description

=begin
これはIntegerをStringに変換するときに
12345678.to_s(:step=>3,:sep=>",") #=> "1,2345,678"
12345678.to_s(:step=>4,:sep=>"'") #=> "1234'5678"
となるものです。
こちらはいかがでしょう?
=end

Actions #1

Updated by duerst (Martin Dürst) over 15 years ago

=begin
最初の例は "12,345,678" のではないでしょうか。

これではインド風の表記が不可能ではないでしょうか ("1,23,45,678", ようするに一番右には三つ、その左は二つずつ)。

Integer だけではなく、他の数はどうでしょうか。
=end

Actions #2

Updated by naruse (Yui NARUSE) over 15 years ago

=begin
成瀬です。

最初の例は "12,345,678" のではないでしょうか。

これではインド風の表記が不可能ではないでしょうか
("1,23,45,678", ようするに一番右には三つ、その左は二つずつ)。

POSIX C の仕様を真似て、
12345678.to_s(:step=>[3, 2, 0], :sep=>",") #=> "1,23,45,678"
とか
12345678.to_s(:step=>"320", :sep=>",") #=> "1,23,45,678"
とか

あとは、:step より :grouping ですかねぇ。

--
NARUSE, Yui

=end

Actions #3

Updated by ko1 (Koichi Sasada) over 15 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

Actions #4

Updated by shyouhei (Shyouhei Urabe) over 13 years ago

  • Status changed from Open to Assigned

=begin

=end

Updated by mame (Yusuke Endoh) about 12 years ago

  • Status changed from Assigned to Rejected

長期間進展がみられないので閉じます。[ruby-core:42391] を参照。

--
Yusuke Endoh

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0