From: Chris Dutton Date: 2002-01-03T04:46:26+09:00 Subject: [ruby-talk:30072] Re: string variable within a string in article 14f21c63.0201020325.4318f5bd@posting.google.com, Paul Vallance at paulvallance@wanadoo.nl wrote on 1/2/02 6:25 AM: > Hi, if I do this > > @data2 = "/gettext(#{v},#{v1},0)\n" > puts @data2 > > ( ...where v is a fixnum = 720 > and v1 is a fixnum = 735...) > > I get the following.... > > "/gettext(720 > ,735 > , > > when I would like to get this > "/gettext(720,735,0) > > the close curly brackets is being interpreted as a carriage return. > Is there another way to put the contents of a variable into a string > without using #{v} maybe... @data2 = "/gettext(%s,%s,0)\n" % [v, v1] puts @data2 Works in Ruby 1.6.5 on OS X 10.1, at least.