What I want is, I think, relatively simple:
> Bin = <<\"Hello.world.howdy?\">>.
> split(Bin, \".\").
[<<\"Hello\">>, <<\"
There is about 15% faster version of binary split working in R12B:
split2(Bin, Chars) ->
split2(Chars, Bin, 0, []).
split2(Chars, Bin, Idx, Acc) ->
case Bin of
<> ->
case lists:member(Char, Chars) of
false ->
split2(Chars, Bin, Idx+1, Acc);
true ->
split2(Chars, Tail, 0, [This|Acc])
end;
<> ->
lists:reverse(Acc, [This])
end.
If you are using R11B or older use archaelus version instead.
The above code is faster on std. BEAM bytecode only, not in HiPE, there are both almost same.
EDIT: Note this code obsoleted by new module binary since R14B. Use binary:split(Bin, <<".">>, [global]). instead.