Displaying 1 result from an estimated 1 matches for "ab123c".
2010 Feb 19
8
Weird gsub behaviour
...bc".gsub("b", str)
puts "abc".gsub("b", "#{str}")
puts "abc".gsub("b", str.to_s)
puts "abc".gsub("b", ''\&123'')
puts "abc".gsub("b", "\&123")
>ruby test.rb
ab123c
ab123c
ab123c
ab123c
a&123c <------------------- This I want to achieve using temporary
variable
>Exit code: 0
If I change
str = ''\&123''
to
str = "\&123"
it works fine, but I get str from "match" function, so I cannot
specify it manually...