keysearch(Key, N, TupleList) -> {value, Tuple} | false
Key = term()
N = 1..tuple_size(Tuple)
TupleList = [Tuple]
Tuple = tuple()
比如说我们有这样的一个列表:
> Attributes = [{to, "jojo@verse.com"},
{from, "oscar@verse.com/school"},
{type, "chat"},
{'xml:lang', "en"}].
> lists:keysearch(from, 1, Attributes).
{value, {from, "oscar@verse.com/school"}}
若指定Key不存在则返回false
> lists:keysearch(not_exist, 2, Attributes).
false
0 意見