[erlang-questions] STRCMP or something like that

Loïc Hoguin <>
Mon Dec 24 15:34:32 CET 2012


1> lists:sort(["alicia", "alex"]).
["alex","alicia"]

:)

On 12/24/2012 03:28 PM, Evren Bayraktar wrote:
> Hi everyone,
>
> I'm having trouble with Erlang  I hope someone can help me. I'm really
> newbie in Erlang :)
>
> I need to something like strcmp in php.
>
> For example;
>
> I have a two different string, Alicia and Alex. I need to steady order
> for them. By parsing each letter I guess I can do that.
>
> $A. returns 65 so I can't compare with first letters then $l. returns
> 108 but they are same too.
> Now, $e. returns 101 and $i. returns 105. By using this numbers I can
> give correct order, first Alex then Alica.
>
> I mean, imagine a function which compare two different variable, by
> using their ascii codes it will return
> correct order.
>
> Function("alicia", "alex") ---> will return alex+alicia
>
> I hope someone will help me
>
> Best Regards
> Evren
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>


-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list