[erlang-questions] Question re io:format and string handling

Jachym Holecek <>
Fri Oct 17 16:41:02 CEST 2008


# David Cabana 2008-10-17:
> Consider the result of evaluating the following in an erl console:
> io:format("The ~p in the ~p", ["cat", "hat"]).
> 
> The strings "cat" and "hat" are substituted for the occurrences of ~p, and a
> string is printed to the console.
> Is there a way to bind that string to a variable instead of printing it to
> the console?

See io_lib:format/2.

	-- Jachym



More information about the erlang-questions mailing list