Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion zero placeholder exponential sprintf?

Path: g2news2.google.com!news3.google.com!feeder.news-service.com!de-l.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail
From: 7stud -- <bbxx789_0...@yahoo.com>
Newsgroups: comp.lang.ruby
Subject: Re: zero placeholder exponential sprintf?
Date: Thu, 6 Aug 2009 01:16:16 -0500
Organization: Service de news de lacave.net
Lines: 30
Message-ID: <5ea3cff8f305a43639ef148c445130c7@ruby-forum.com>
References: <h5a93t$938$1@news.eternal-september.org>
	<79621bdb0908041806l68fa57bcm778a788b318ca4d0@mail.gmail.com>
	<h5bqok$vvf$1@news.eternal-september.org>
NNTP-Posting-Host: bristol.highgroove.com
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: talisker.lacave.net 1249539398 91337 65.111.164.187 (6 Aug 2009 06:16:38 GMT)
X-Complaints-To: abuse@lacave.net
NNTP-Posting-Date: Thu, 6 Aug 2009 06:16:38 +0000 (UTC)
In-Reply-To: <h5bqok$vvf$1@news.eternal-september.org>
X-Received-From: This message has been automatically forwarded from the
	ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did
	not originate at comp.lang.ruby. Please report the original sender, and not
	us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway 
X-Mail-Count: 343297
X-Ml-Name: ruby-talk
X-Rubymirror: Yes
X-Ruby-Talk: <5ea3cff8f305a43639ef148c44513...@ruby-forum.com>

Bil Kleb wrote:
> 
> Sorry for the confusion, String::% uses Kernel::sprintf -- see
> 
>    http://www.ruby-doc.org/core/classes/String.html#M000770
> 

Uh, no.

class Object
  def sprintf(*args)
    puts "inside sprintf..."
    "hello"
  end
end

result = sprintf("%.6e", 1.123450e4)
puts result

puts "%.6e" % 1.123450e4

--output:--
inside sprintf...
hello
1.123450e+04


-- 
Posted via http://www.ruby-forum.com/.