io_lib:format and ++
Tue Feb 19 07:54:17 CET 2002
Hal Snyder <> writes:
> I don't think io_lib:format is returning a flat character string.
> We have:
> 1> "hello " ++ "there".
> "hello there"
> 2> io_lib:format("hello ~s", ["there"]).
> So, cooking long strings with io_lib:format() gave me a surprise when
> the next thing to happen was a regexp:split, which does care about
> Bug, or confused programmer?
This is a feature. From the reference manual
io_lib - IO Library Functions
This module contains functions for converting to and from
strings (lists of characters). They are used for implement-
ing the functions in the io module. There is no guarantee
that the character lists returned from some of the functions
are flat, they can be deep lists. lists:flatten/1 is used
for generating flat lists.
But the reference manual fr io_lib lack type information for the
functions so it is easy to missinterpret.
More information about the erlang-questions