But it will not work if you use single quotes ('), you have to use double
quotes (") if you have variable inside the string.
new_string = "abcdef#{var1}jklmnop"
Zeljko
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Rogers
Sent: Wednesday, July 27, 2005 7:43 PM
To: [email protected]
Subject: RE: [Wtr-general] Inserting variable name in string
You're close!
New_string = 'abcdef#{var1}jklmnop'
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Torres, Ben
(HQP)
Sent: 27 July 2005 11:36
To: [email protected]
Subject: [Wtr-general] Inserting variable name in string
Right now, I am doing this:
var1 = 'ghi'
new_string = 'abcdef' + var1 + 'jklmnop'
Is there any way I can insert the variable name within the string? I
tried doing this, but it didn't work:
New_string = 'abcdef{var1}jklmnop'
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general