目录

find

此方法用于查找地图中是否存在特定键。

语法 (Syntax)

find(key,map)

参数 (Parameters)

  • key - 这是需要转换为地图的列表。

  • map - 这是需要搜索密钥的映射。

返回值 (Return Value)

如果在地图中找到键,则返回该值。

例如 (For example)

-module(helloworld). 
-export([start/0]). 
start() -> 
   Lst1 = [{"a",1},{"b",2},{"c",3}], 
   Map1 = maps:from_list(Lst1), 
   io:fwrite("~p~n",[maps:find("a",Map1)]).

输出 (Output)

上述程序的输出如下。

{ok,1}
↑回到顶部↑
WIKI教程 @2018