Paste number 69677: split_binary_on

Paste number 69677: split_binary_on
Pasted by: mmagin
When:1 year, 9 months ago
Share:Tweet this! | http://paste.lisp.org/+1HRH
Channel:None
Paste contents:
Raw Source | XML | Display As
split_binary_on(B, Match) ->
    split_binary_on(B, Match, <<>>).

split_binary_on(<<Char, Rest/binary>>, Match, Accum) ->
    case Char of 
	Match ->
	    {Accum, Rest};
	_otherwise ->
	    split_binary_on(Rest, Match, list_to_binary([Accum, Char]))
    end.

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.