<div dir="ltr">Consider the result of evaluating the following in an erl console:<br>io:format("The ~p in the ~p", ["cat", "hat"]).<br><br>The strings "cat" and "hat" are substituted for the occurrences of ~p, and a string is printed to the console.<br>
Is there a way to bind that string to a variable instead of printing it to the console?<br><br>What I am after is a facility somewhat like the one used in the Python example below:<br>phrase = "The %s in the %s" % ("cat", "hat")<br>
<br>Evaluating the example above results in the variable 'phrase' taking the value "The cat in the hat".<br> <br>The similarity to the io:format behavior is clear. The Python idiom is useful, and I have been looking for something<br>
similar in Erlang, without luck. Before I try to concoct such a thing, I thought I'd ask whether it already exists.<br><br>Thanks,<br>David<br><br></div>