Skip to content

Instantly share code, notes, and snippets.

@deadc0de6
Created December 8, 2017 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deadc0de6/99d6576dc77faa43b30b0dfa7076fb1f to your computer and use it in GitHub Desktop.
Save deadc0de6/99d6576dc77faa43b30b0dfa7076fb1f to your computer and use it in GitHub Desktop.
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