From: paulvallance@... (Paul Vallance) Date: 2002-01-03T00:46:07+09:00 Subject: [ruby-talk:30047] Re: string variable within a string My fault, the numbers 720 and 735 are returned from the TCP Server as strings, so to put them into a send string to be sent back to the server in a following send string I created new integer variables using var.to_i so.... x = v.to_i y = v1.to_i t.send(/gettext(#{x},#{y},0)\n",0) works fine thanks Paul ts wrote in message news:<200201021131.g02BV9t20719@moulon.inra.fr>... > >>>>> "P" == Paul Vallance writes: > > P> the close curly brackets is being interpreted as a carriage return. > P> Is there another way to put the contents of a variable into a string > P> without using #{v} > > No, not really. The variable `v' and `v1' was probably read with #gets and > this mean that it exist a \n at the end > > pigeon% ruby -e 'v = gets; puts v.inspect; print "#{v}"' > 12 > "12\n" > 12 > pigeon% > > You must use #chomp > > pigeon% ruby -e 'v = gets; v.chomp!; puts v.inspect; print "#{v}"' > 12 > "12" > 12pigeon% > > > > > Guy Decoux