How to convert an integer to a string in Erlang?

collapsinghrung picture collapsinghrung · Feb 25, 2009 · Viewed 46.1k times · Source

I know strings in Erlang can be costly to use. So how do I convert "5"to 5?

Is there anything like io:format("~p",[5]) that would return a formatted string instead of printing to a stream?

Answer

womble picture womble · Feb 25, 2009

There's also integer_to_list/1, which does exactly what you want, without the ugliness.