strings are lists :S

me llevo un rato encontrar este bug


2> lists:suffix(".fn", io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"])).
false
3> lists:suffix(".fn", lists:flatten(io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"]))).
true


la razon es que


1> io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"]).
["1",45,"2",45,"3",46,"fn"]


y no lo que uno esperaria


4> lists:flatten(io_lib:format("~p-~p-~p.~s", [1,2,3,"fn"])).
"1-2-3.fn"

Comments

Comments powered by Disqus