Wow, I'd always thought that single quotes prevented "variable
expansion" and didn't realize that Ruby variable expansion does work
inside single quotes so I had to try this.
Looks like it will work if the *outer* quotes are double quotes, even if
inside single quotes inside. However, it doesn't work if the outer
quotes are single quotes:
irb(main):085:0> my_string = "here-it-is"
=> "here-it-is"
irb(main):086:0> "//[EMAIL PROTECTED]'#{my_string}']"
=> "//[EMAIL PROTECTED]'here-it-is']"
irb(main):087:0> '#{my_string}'
=> "\#{my_string}"
Bret Pettichord wrote:
> On 5/17/06, *Rodrigo Julian Martin* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> I have this sentence:
>
> ie.select_list(:xpath, "//[EMAIL PROTECTED]'missing']")
>
> How can I pass a string variable for the name?
>
> I've tried with this, but didn“t work...
> ie.select_list(:xpath, "//[EMAIL PROTECTED]"#{variable}"]")
>
> I have troubles with double and simple hyphens...
>
>
> Why did you change the inner quotes on the second try? This should work:
>
> ie.select_list(:xpath, "//[EMAIL PROTECTED]'#{variable}']")
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general