I want to turn a Pid in erlang <0.121.0> into a string, how would I do this?
Is there a way to pattern match against a Pid?
{Node, Index, Number} = <0.121.0>.
pid_tokens(Pid) ->
PidStr = pid_to_list(Pid),
PidStr1 = lists:sublist(PidStr, 2, length(PidStr)-2),
[N, P1, P2] = [list_to_integer(T) || T <- string:tokens(PidStr1,[$.])],
{N, P1, P2}.
Something like this may work for you. Where Pid is process id you want to match
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With