what is the meaning of the following instruction
aaa.gsub!(’@variable@’, current)
Because it’s a string, and in single quotes, surely it would be taken
literally and any instance of @vraiable@ in aaa would be replaced with
whatever is in the current variable
Yule;
Paul B. wrote in post #1072189:
Because it’s a string, and in single quotes, surely it would be taken
literally and any instance of @vraiable@ in aaa would be replaced with
whatever is in the current variableYule;
what is that ‘@’ in both ends?
Paul B. wrote in post #1072189:
Because it’s a string, and in single quotes, surely it would be taken
literally and any instance of @vraiable@ in aaa would be replaced with
whatever is in the current variableYule;
what is that ‘@’ in both ends?
Just that, an @ character. So
aaa = ‘This is a string @variable@ blah blah blah’
current = ‘XXXX
aaa.gsub!(’@variable@’, current)
aaa
==> ‘This is a string XXXX blah blah blah’
On Mon, Aug 13, 2012 at 6:10 AM, Paul B. [email protected]
wrote:
Just that, an @ character. So
aaa = ‘This is a string @variable@ blah blah blah’
current = ‘XXXX
aaa.gsub!(’@variable@', current)
aaa
==> ‘This is a string XXXX blah blah blah’
To expand on this – probably @ has some meaning like “the enclosed
string should be replaced with a value” in whatever program Ajay is
working with. But it doesn’t mean anything to Ruby itself.
‘@’ at both ends is just a part of the string, nothing special about it.
Regards,
Krishna A…