differentiate a string from a list in Erlang

前端 未结 2 1819
逝去的感伤
逝去的感伤 2020-12-19 03:11

In Erlang when you have a list of printable characters, its a string, but a string is also a list of items and all functions of a list can be applied onto a string. Really,

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 03:29

    You have two functions in the module io_lib which can be helpful: io_lib:printable_list/1 and io_lib:printable_unicode_list/1 which test if the argument is a list of printable latin1 or unicode characters respectively.

提交回复
热议问题