Erlang::为什么Erlang中的rpc:pmap调用不适用于字符串库函数?

8iwquhpp  于 12个月前  发布在  Erlang
关注(0)|答案(1)|浏览(118)
string:find("This is a test wa.me/123456 message alibaba","wa.me").

工作正常匹配wa.me但低于代码

erpc:pmap({string,find},["This is a test wa.me/123456 message alibaba"],["wa.me"]).

不起作用,让我如果有人知道失败的原因
谢谢
试过这个

erpc:pmap({string,find},["This is a test wa.me/123456 message alibaba"],["wa.me"]).

期望wa.me/123456 message alibaba
但得到

[nomatch]
vltsax25

vltsax251#

首先,没有erps:pmap/3函数,pmap/3是从rpc模块导出的。
然后,参数的顺序如下所示:

@spec pmap(funcSpec, extraArgs, list1) :: list2
        when funcSpec: {module, function},
             module: module(),
             function: atom(),
             extraArgs: [term()],
             list1: [elem :: term()],
             list2: [term()]

也就是说,正确的决定应该是

rpc:pmap({string, find}, ["wa.me"], ["This is a test wa.me/123456 message alibaba"])
#⇒ ["wa.me/123456 message alibaba"]

相关问题