<div dir="ltr">Hi Roger thank you for replying.<div>I am having a series of 0s an1s in a List and want to convert it to a decimal number.</div><div>I am looking for something similar to BItSet in java</div><div><br></div><div>Kind Regards</div><div>Nikolas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Πέμ 9 Δεκ 2021 στις 3:24 μ.μ., ο/η Roger Lipscombe <<a href="mailto:roger@differentpla.net">roger@differentpla.net</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 9 Dec 2021 at 13:29, Java House <<a href="mailto:java4dev@gmail.com" target="_blank">java4dev@gmail.com</a>> wrote:<br>
> Thank you Roger for the answer<br>
> I thought about it but since I have to parse all digits for every row that would mean a lot of entries as I have to create all possible combinations of 0/1 for every position of the row.<br>
<br>
parse(Data) -> parse(Data, [], []).<br>
<br>
parse(<<"0", Rest/binary>>, Line, Lines) -><br>
parse(Rest, [false | Line], Lines);<br>
parse(<<"1", Rest/binary>>, Line, Lines) -><br>
parse(Rest, [true | Line], Lines);<br>
parse(<<$\n, Rest/binary>>, Line, Lines) -><br>
parse(Rest, [], [lists:reverse(Line) | Lines]);<br>
parse(<<>>, [], Lines) -> lists:reverse(Lines);<br>
parse(<<>>, Line, Lines) -> lists:reverse([lists:reverse(Line) | Lines]).<br>
<br>
...results in...<br>
<br>
[[true,true,true,false,true,true,false,false,true,false,true,false],<br>
[false,true,false,false,true,true,true,false,true,true,true,false],<br>
[true,true,false,false,false,true,false,false,true,false,true,false],<br>
[false,false,true,true,false,true,false,true,true,true,false,true],<br>
[true,true,false,true,false,false,false,false,false,false,true,true],<br>
[false,true,false,true,true,false,true,true,false,false,true,false]]<br>
</blockquote></div>