[erlang-questions] Avoiding case nesting
Mon Sep 28 15:03:49 CEST 2009
On Mon, Sep 28, 2009 at 9:10 PM, Ulf Wiger
> I would probably use lists:dropwhile/2 in this
> situation, at least if you do not expect to take action
> in the case where it isn't a prefix.
> List = prefixes(),
> case lists:dropwhile(fun(P) -> not_prefix(P, String) end, List) of
>  ->
> % no prefix
> [Prefix|_] ->
> Tail = lists:nthtail(length(Prefix), String),
This one works nice too.
More information about the erlang-questions