Ryan Leavengood
7/15/2005 3:05:00 PM
YANAGAWA Kazuhisa said:
>
> You can use:
>
> "mere single double-quotation
> for multi-line string"
>
> str = <<EOS
> or use here document
> for multi-line string
> EOS
There is also %q (works like single quotes) and %Q (works like double
quotes, i.e. has interpolation):
irb(main):009:0> %q{"Look", you can "use" 'all' "the" "quotes" "you" want
irb(main):010:0' and "on" multiple "lines"
irb(main):011:0' 'yep'}
=> "\"Look\", you can \"use\" 'all' \"the\" \"quotes\" \"you\" want\nand
\"on\" multiple \"lines\"\n'yep'"
irb(main):012:0> %Q{"#{1+1}" and 'blah'
irb(main):013:0" "foo"}
=> "\"2\" and 'blah'\n\"foo\""
Ryan