What I want is, I think, relatively simple:
> Bin = <<"Hello.world.howdy?">>.
> split(Bin, ".").
[<<"Hello">>, <<"world">>, <<"howdy?">>]
Any pointers?
What I want is, I think, relatively simple:
> Bin = <<"Hello.world.howdy?">>.
> split(Bin, ".").
[<<"Hello">>, <<"world">>, <<"howdy?">>]
Any pointers?
The module binary from EEP31 (and EEP9) was added in Erts-5.8 (see OTP-8217):
Here's one way:
There is no current OTP function that is the equivalent of
lists:split/2
that works on a binary string. Until EEP-9 is made public, you might write a binary split function like:There is about 15% faster version of binary split working in R12B:
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.