1、[PoolId, Hostname,Port, Username, Password, Database, LogFun, Encoding, PoolSize] =

foldl(Fun(Elem, AccIn), Acc0, List) -> Acc1  %%AccIn初使为Acc0, Elem是List中的值,把List中的所有值都执行函数一次得到列表

lists:foldl(fun(Key, Acc) ->
    [proplists:get_value(Key, Options) | Acc]  end,  [], lists:reverse([pool_id, hostname, port, username,password,database, logfun, encoding, poolsize]))

注:这儿的Options="[{hostname,"localhost"}, {username, "root"}, {password,"sa"}, {database, "test"}]"

结果为[undefine,"localhost", undefine,"root","sa","test", undefine, undefine, undefine]

2、

 

相关文章:

  • 2022-01-08
  • 2021-04-24
  • 2021-10-16
  • 2021-10-05
  • 2021-08-23
  • 2021-12-24
  • 2021-06-19
猜你喜欢
  • 2022-12-23
  • 2021-12-05
  • 2021-11-22
  • 2021-10-21
相关资源
相似解决方案