此方法用于查找Map中是否存在特定键。
find(key,map)
key - 这是需要转换为Map的列表。
Map - 这是需要在其中搜索键的Map。
如果在Map上找到键,则返回值。
链接:https://www.learnfk.comhttps://www.learnfk.com/erlang/erlang-find.html
来源:LearnFk无涯教程网
-module(helloLearnfk). -export([start/0]). start() -> Lst1=[{"a",1},{"b",2},{"c",3}], Map1=maps:from_list(Lst1), io:fwrite("~p~n",[maps:find("a",Map1)]).
上面程序的输出如下。
{ok,1}
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)