Binary matching

Danie Schutte <>
Tue Dec 21 23:20:03 CET 2004


On Mon, 2004-12-20 at 12:39 -0200, Inswitch Solutions - Erlang
Evaluation wrote:

>  
> Does someone know why the following binary matching fails?
>  <<X:7/binary, Rest/binary>> = <<0>>

I think the problem lies with the fact that X:7/binary will look for 7
binary BYTES of data and not 7 BITS.
<<X:7, Rest/binary>> = <<0>> might be more what you are looking for.


>  
> Is there an elegant way to group an octect binary in seven bits
> values?
> For example eight characters (1 character = 1 byte) in seven octects.
>  
>  
> thanks,
> Eduardo Figoli
> INSwitch Solutions
>  
>  
>  
>  
>  

-- 
Danie Schutte <>
Erlang Financial Systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20041222/3a9aed5e/attachment.html>


More information about the erlang-questions mailing list