Long string assignment

Hi,

In php, I can use the following code :

$str = <<<aa
hello,
how are you?
aa
;

But how can I do this in ruby ?

Thank you.

···

--
--
WenGe Wang

Alle lunedì 11 giugno 2007, w wg ha scritto:

Hi,

In php, I can use the following code :

$str = <<<aa
hello,
how are you?
aa
;

But how can I do this in ruby ?

Thank you.

str = <<EOS
hello,
how are you?
aa
EOS

Stefano

str = <<aa
hello,
how are you?
aa

or

# with interpolation, not shown in this example
str = %Q{aa
hello,
how are you?
}

or

# without interpolation
str = %q{aa
hello,
how are you?
}

Kind regards

  robert

···

On 11.06.2007 16:26, w wg wrote:

Hi,

In php, I can use the following code :

$str = <<<aa
hello,
how are you?
aa
;

But how can I do this in ruby ?

Thank you very much. it works.

···

2007/6/11, Stefano Crocco <stefano.crocco@alice.it>:

Alle lunedì 11 giugno 2007, w wg ha scritto:
> Hi,
>
> In php, I can use the following code :
>
> $str = <<<aa
> hello,
> how are you?
> aa
> ;
>
> But how can I do this in ruby ?
>
> Thank you.

str = <<EOS
hello,
how are you?
aa
EOS

Stefano

--
--
WenGe Wang

or even just

str = %{aa
hello
how are you?
)

···

On 6/11/07, Robert Klemme <shortcutter@googlemail.com> wrote:

or

# without interpolation
str = %q{aa
hello,
how are you?
}

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/

Oops, I meant either

str = $(aa
hello
how are you?
)

or

str = ${aa
hello
how are you?
}

···

On 6/11/07, Rick DeNatale <rick.denatale@gmail.com> wrote:

On 6/11/07, Robert Klemme <shortcutter@googlemail.com> wrote:

>
> or
>
> # without interpolation
> str = %q{aa
> hello,
> how are you?
> }

or even just

str = %{aa
hello
how are you?
)

--
Rick

msg = "FULL OF INTERPOLATION GOODNESS"
str = %{aa
  hello
  how ara you?
  #{msg}
}

puts str
#=> aa
#=> hello
#=> how ara you?
#=> FULL OF INTERPOLATION GOODNESS

···

On Jun 11, 12:34 pm, "Rick DeNatale" <rick.denat...@gmail.com> wrote:

On 6/11/07, Robert Klemme <shortcut...@googlemail.com> wrote:
> # without interpolation
> str = %q{aa
> hello,
> how are you?
> }

or even just

str = %{aa
hello
how are you?
)

Thanks, I corrected my initial typo without too much thought.

···

On 6/11/07, Phrogz <gavin@refinery.com> wrote:

On Jun 11, 12:34 pm, "Rick DeNatale" <rick.denat...@gmail.com> wrote:
> On 6/11/07, Robert Klemme <shortcut...@googlemail.com> wrote:
> > # without interpolation
> > str = %q{aa
> > hello,
> > how are you?
> > }
>
> or even just
>
> str = %{aa
> hello
> how are you?
> )

msg = "FULL OF INTERPOLATION GOODNESS"
str = %{aa
  hello
  how ara you?
  #{msg}
}

puts str
#=> aa
#=> hello
#=> how ara you?
#=> FULL OF INTERPOLATION GOODNESS

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/