binary split and the options
Why is this function returning 3 elements ?
[<<"12345">>,<<"67890">>,<<>>]
test3()->
test4(<<"12345\r\n67890\r\n">>).
test4(Data)->
X = binary:split(Data, [<<"\r\n">开发者_Go百科;>],[global]),
X.
binary:split(Subject,Pattern,Options)
will split the binary object into the part of the binary that is before the splitting delimiter, and the parts after.
Consider adding the trim options for the binary:split, i.e.
binary:split(Data, [<<"\r\n">>],[trim,global]),
精彩评论