Logo

Programming-Idioms

History of Idiom 48 > diff from v14 to v15

Edit summary for version 15 by :

Version 14

2015-10-22, 01:00:55

Version 15

2015-10-29, 14:05:14

Idiom #48 Multi-line string litteral

Assign to variable s a string litteral consisting in several lines of text

Idiom #48 Multi-line string litteral

Assign to variable s a string litteral consisting in several lines of text

Code
S = "Strings
may span
across multiple lines"
"and they can"
"have as many portions"
"as you want"
"all of them quoted".
Code
S = "Strings
may span
across multiple lines"
"and they can"
"have as many portions"
"as you want"
"all of them quoted".
Comments bubble
variables are uppercased here
Comments bubble
variables are uppercased here
Doc URL
http://www.erlang.org/doc/reference_manual/data_types.html#id70609
Doc URL
http://www.erlang.org/doc/reference_manual/data_types.html#id70609
Demo URL
http://tryerl.seriyps.ru/#id=22f3
Demo URL
http://tryerl.seriyps.ru/#id=22f3
Code
let s = "line 1
line 2
line 3";
Code
let s = "line 1
line 2
line 3";
Origin
http://stackoverflow.com/a/29483453/3369597
Origin
http://stackoverflow.com/a/29483453/3369597
Demo URL
http://is.gd/xvDCI4
Demo URL
http://is.gd/xvDCI4
Code
$s = "Perl normally allows
strings to contain newlines.";
$s = q{
There are a good few ways to create multiline
text strings in perl.
};
$s =<<EOSTR;
One of them is called the "here doc" (lifted from various UNIX shells).
A 'here doc' is the <<tag construct.  Perl continues to treat
all the text found as part of the string until there's a line containing
the EOSTR tag at the beginning
EOSTR
Code
$s = "Perl normally allows
strings to contain newlines.";
$s = q{
There are a good few ways to create multiline
text strings in perl.
};
$s =<<EOSTR;
One of them is called the "here doc" (lifted from various UNIX shells).
A 'here doc' is the <<tag construct.  Perl continues to treat
all the text found as part of the string until there's a line containing
the EOSTR tag at the beginning
EOSTR