Erlang - binary_to_atom



This method is used to convert a binary value to an atom value.

Syntax

binary_to_atom(binaryvalue)

Parameters

  • binaryvalue − This is the binary value which needs to be converted to an atom value.

Return Value

An atom based on the binary value.

For example

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

start() -> 
   io:fwrite("~p~n",[binary_to_atom(<<"Erlang">>, latin1)]).

Output

The output of the above program is as follows.

‘Erlang’
erlang_atoms.htm
Advertisements