[erlang-questions] binary:part/2/3
Zabrane Mickael
zabrane3@REDACTED
Tue Aug 14 12:10:29 CEST 2012
Hi Jesper,
You're right. From "binary.erl" source code:
[..]
split(Haystack,Needles,Options) ->
...
do_split(Haystack,MList,0,Trim)
...
do_split(H,[],N,true) when N >= byte_size(H) ->
[];
do_split(H,[],N,_) ->
[binary:part(H,{N,byte_size(H)-N})]; <---- HERE
do_split(H,[{A,B}|T],N,Trim) ->
case binary:part(H,{N,A-N}) of <---- HERE
...
So yes, binary:split uses binary:part for sure.
Can OTP guys confirm this fact now?
Regards,
Zabrane
On Aug 14, 2012, at 11:54 AM, Jesper Louis Andersen wrote:
> Try looking at the source. If I remember correctly, binary:split uses binary:part inside. If this is the case, then you can update the documentation as well to reflect the fact.
>
> Jesper Louis Andersen
> Erlang Solutions Ltd., Copenhagen
>
>
>
> On Aug 13, 2012, at 7:52 PM, Zabrane Mickael <zabrane3@REDACTED> wrote:
>
>> Hi guys,
>>
>> I'd like to know if the binary returned by "binary:part/2/3" (http://www.erlang.org/doc/man/binary.html#part-2)
>> is always referencing Subject (i.e a sub-binary) or not?
>>
>> The doc is clear about this fact for "binary:split/2/3" but nothing is mentionned for "binary:part/2/3".
>>
>> Regards,
>> Zabrane
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list