<meta content="text/html; charset=ISO-8859-1"
<body bgcolor="#FFFFFF" text="#000000">
Given you generate chunks of HTML and that this will undoubtedly be
pushed over a socket at some point, what you want to use is IO
They are lists of either bytes (integers from 0 to 255), binaries,
or other IO lists. This means that functions that accept IO lists
can accept items such as <tt>[$H, $e, [$l, <<"lo">>, "
"], [[["W","o"], <<"rl">>]] | [<<"d">>]]</tt>.
When this happens, the Erlang VM will just flatten the list as it
needs to do it to obtain the sequence of characters <tt>Hello World</tt>.<br>
<meta http-equiv="content-type" content="text/html;
Any function from the io module, file module, TCP and UDP sockets
will be able to handle them. Some library functions, such as some
coming from the unicode module and all of the functions from the re
(for regular expressions) module will also handle them, to name a
So in your case, to join string A and B, no matter whether they're
binaries or lists, just do <tt>[A,B]</tt> and that's your new
string. You'll save a lot in terms of rewriting terms and whatnot
doing things that way.<br>
On 12-05-07 9:31 AM, Paul Barry wrote:
<pre wrap="">Hi folks.
This might be a case of a dumb question, but here goes anyway. :-)
I have two strings, A and B. Is it better to use:
A ++ B
when combining them to create a new string? I'm writing some code
that generates a chunk of HTML. I know that using ++ on big lists is
regarded as a "no-no", but is it acceptable here?