[erlang-questions] Binaries and "strings"

Per Melin per.melin@REDACTED
Sat Feb 27 12:21:20 CET 2010


On Fri, Feb 26, 2010 at 11:42 PM, Robert Virding <rvirding@REDACTED> wrote:
>> 2> <<"one" "two">>.
>> <<"onetwo">>
>
> Here the two string are concatenated to one already in the parser, so
> you are actually writing <<"abcdef">>. This is feature is useful as it
> allows you to split a long string into many sub strings without extra
> computational cost.

Could be worth to mention explicit, since it doesn't seem to be well
known, that this of course works over line breaks. It is, as you say,
useful for long string literals in your code, like help and usage
texts, or raw XML/HTML.

1> "Lorem ipsum dolor sit amet, "
1> "consectetur adipisicing elit".
"Lorem ipsum dolor sit amet, consectetur adipisicing elit"


More information about the erlang-questions mailing list