Joining A List Of Binaries In Erlang
-spec binary_join(List :: list(binary()), Separator :: binary()) -> binary().
binary_join(List, Separator) ->
lists:foldl(fun(Item, Acc) ->
if
bit_size(Acc) > 0 -> <<Acc/binary, Separator/binary, Item/binary>>;
true -> Item
end
end, <<>>, List).
Written by sl
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Erlang
Authors
Related Tags
#erlang
#binary
#join
#joining
#list of binaries
#join list of binaries
#joining list of binaries
#join binary list
#joining binary list
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#