From: Rob Biedenharn Date: 2007-09-25T02:44:21+09:00 Subject: Re: literal quote in an array? On Sep 24, 2007, at 1:37 PM, Gaspard Bucher wrote: > 2007/9/24, Simon Schuster : >> using colons for now, but would like to somehow encapsulate a >> sentence >> in this way (basically), with quotes. >> >> speaker = ["joe ", "betty "] >> expression = ["said: ", "replied: ", "stated: "] >> content = ["hello.", "bye."] >> >> 053:0> sentence = speaker[0] + expression[1] + content[0] >> "joe replied: hello." >> but I'd like to get: >> "joe replied, "hello."" >> >> thanks! >> >> !DSPAM:46f7f33b123781222944467! > This can work if you do not have strange characters in the content: > sentence = speaker[0] + expression[1] + content[0].inspect > > This is better: > sentence = speaker[0] + expression[1] + "\"#{content[0]}\"" Or better still: sentence = %{#{speaker[0]} #{expression[1]} "#{content[0]}"} Then you don't need the extra spaces in the speaker and expression elements. -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com