Erlang - binary_to_integer



This method is used to convert a binary value to a integer value.

Syntax

binary_to_integer(binaryvalue)

Parameters

  • binaryvalue − This is binary value which needs to be converted to a integer value.

Return Value

Returns the integer value from the binary value.

For example

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

start() -> 
   io:fwrite("~p~n",[binary_to_integer(<<"2">>)]).

Output

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

2
erlang_binaries.htm
Advertisements