gen_tcp:send failing silently

fgonthier <>
Mon Feb 23 06:29:55 CET 2004


> parse ([$: | Line]) ->
>     [Sender | Rest] = string:tokens (Line, " "),
> ...

[$: | Line] is what was missing to my comprehension.  Here is my parser now:

parse([$: | Rest]) ->
    {ok, [Params | Message]} = regexp:split(Rest, " :"),
    [Source | Details] = string:tokens(Params, " "),
    {Source, Details ++ case Message of
			    [] ->
				[];
			    _ ->
				[join(Message, " :")]
			end};
parse(Command) ->
    {system, string:tokens(Command, " :")}.


join ([], _) -> "";
join ([X], _) -> X;
join ([X | Xs], C) -> X ++ C ++ join (Xs, C).





More information about the erlang-questions mailing list