[erlang-questions] Binary matching partials

Mike Oxford moxford@REDACTED
Wed Feb 12 10:48:08 CET 2014


decode(Charset, <<A:6,B:6,C:6,D:6, T/binary>>, Acc)

Match incoming stuff, 3 bytes at a time and put the remainder in T.  No
problem.

If I get 5 bytes it has issues because it's not on the 3-byte boundary.
 Fine ... except ...

I've tried...

1)  Match less params...try <<A,B,C,D, T>> then <<A,B,C,D >>, <<A,B,C>>,
<<A,B>> and so on.
2)  Match against zeros <<A:6, B:6, 0:6, 0:6>>
3)  Match against various combinations of bit-widths and remainder/tails

It seems as if it must match exactly, yet matching against the varying
levels of parameters doesn't seem to work.

I couldn't find anything on Google about this particular matching case.

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140212/02c04fee/attachment.htm>


More information about the erlang-questions mailing list