Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
find_null(Bin, Pos) ->
case Bin of
<<Start:Pos/binary, 0, Rest/binary>> ->
% found
{Start, Rest};
<<Bin:Pos/binary>> ->
% not found
error;
<<_:Pos/binary, _/binary>>=B ->
% go forward
find_null(B, Pos+1)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment