From: Alex Young Date: 2007-11-04T21:30:29+09:00 Subject: Re: sprintf percent sign problem mpthimios wrote: > Hi, > I am trying to format some text using sprintf. The text itself > contains the percent sign (%). > > When I use it without any escape character, as expected ruby throws > error (unkonown format sequence). > > When I use the "\%" sequence ruby complaints when the "\%" is > somewhere in the text. When it is at the end it works but I don't want > it there. > > When I use the "%%" sequence, I get the exact sequence as output ("%%" > is printed!!).. \ > > Has anyone observed this behavior? Am I doing something wrong or it is > a ruby bug? I don't see that: irb(main):001:0> text = "foo%%bar" => "foo%%bar" irb(main):002:0> sprintf(text) => "foo%bar" -- Alex