Erlang: How does one avoid Lists being translated to ASCII Strings?

↘锁芯ラ 提交于 2019-12-10 19:36:47

问题


[97, 98, 99]. yields "abc", in the Erlang shell. I realize this is because the ASCII values of a, b and c are 97, 98 and 99 respectively.

So.. how would one go about returning [97,98,99] without Erlang translating it to ASCII?


回答1:


You can try io:format("~w~n", [ListHere]), which should simply avoid interpreting the data.




回答2:


Try this

YourList ++ [0]

With "abc"

"abc" ++ [0]

[97,98,99,0]



来源:https://stackoverflow.com/questions/3833078/erlang-how-does-one-avoid-lists-being-translated-to-ascii-strings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!