Reputation: 3017
I want to check if the string contains a specific character or alphanumeric number present in it.
Eg.
Line = "23423+e324AB".
What will be the best possible solution to find if the string 'Line' contains '+' symbol??
Thanks :)
Upvotes: 0
Views: 2768
Reputation: 449
Probably, best is lists:member(hd("+"),"fff+fdd")
.
Time execution is fastes
9> timer:tc(fun() -> lists:member(hd("+"),"fff+fdd") end).
{11,true}
10> timer:tc(fun() -> string:str("ff+ggg", "+") > 0 end).
{1965,true}
Upvotes: 3