Erlang字符串比较不是';行不通

Erlang字符串比较不是';行不通,erlang,Erlang,几个小时来,我一直在尝试比较两个数据位 这基本上就是我写的 find_client(Search, [Client|Client_list])-> {Name,Socket} = Client, io:fwrite("Name>~s<~n",[Name]), io:fwrite("Search>~s<~n",[Search]), case string:equal(Name,Search) of true->

几个小时来,我一直在尝试比较两个数据位

这基本上就是我写的

find_client(Search, [Client|Client_list])->
   {Name,Socket} = Client,
   io:fwrite("Name>~s<~n",[Name]),
   io:fwrite("Search>~s<~n",[Search]),
   case string:equal(Name,Search) of
      true->
         do_something;
      false->
         do_something_else
   end;
find_client(Search,[])->
   not_found.
find_客户端(搜索[客户端|客户端列表])->
{Name,Socket}=Client,

io:fwrite(“Name>~s~s所有这些都打印相同的东西,因为~s以相同的方式格式化iolist(和atoms!)

io:fwrite("~s~n", ["name"]),
io:fwrite("~s~n", [<<"name">>]),
io:fwrite("~s~n", [name]),
io:fwrite("~s~n", [[$n, $a, <<"m">>, "e"]]).

所有这些都打印相同的东西,因为~s以相同的方式格式化IOLIST(和原子!)

io:fwrite("~s~n", ["name"]),
io:fwrite("~s~n", [<<"name">>]),
io:fwrite("~s~n", [name]),
io:fwrite("~s~n", [[$n, $a, <<"m">>, "e"]]).
iolist_equal(A, B) ->
    iolist_to_binary(A) =:= iolist_to_binary(B).