[erlang-questions] can you directly generate a binary from format/2 ?

Matthias Lang <>
Fri Apr 17 08:10:17 CEST 2009


On Thursday, April 16, Steve Kirsch wrote:
> io_lib:format("test", []).
> 
> returns the string "test".
> 
> What I'd like is a way to return <<"test">> instead from the output of
> format.
> 
> Is there a format/2 somewhere that returns a binary?

No, not directly. I assume you're aware of erlang:list_to_binary/1.

Matthias




More information about the erlang-questions mailing list