[erlang-questions] string to binary

Chandru <>
Wed Oct 19 12:12:50 CEST 2011


Here is one solution.

list_to_binary([list_to_integer(X) || X <-
string:tokens("00:11:22:33:44:55", ":")]).

cheers
Chandru

On 19 October 2011 00:02, Wes James <> wrote:

> Is there a way to get "00:11:22:33:44:55" in to this format
> <<16#00,16#11,16#22,16#33,16#44,16#55>>?
>
> I can do string:tokens(S) to split the string (list) up, but how do
> you put back in <<16#....>>  format?
>
> thanks,
>
> -wes
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111019/d4863e8e/attachment.html>


More information about the erlang-questions mailing list