Erlang – split_binary

Erlang split_binary

In this guide, we will discuss Erlang Split_binary. This method is used to split the binary list based on the index position specified.

Syntax

split_binary(binarylst,index)

Parameters

  • binarylst − This is the binary list which needs to be split.
  • index − This is the index position in which the list should be split.

Return Value

Returns the split binary string.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[split_binary(<<1,2,3,4,5>>,3)]).

Output

When we run the above program we will get the following result.

{<<1,2,3>>,<<4,5>>}

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply