From b074099cc6bdb81285a17e0248373f199c695719 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 5 Sep 2012 20:43:03 +0200 Subject: Add new binary conversion bifs Added: binary_to_integer/1,2, integer_to_binary/1,2 --- erts/doc/src/erlang.xml | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 5a63aaadc6..36d606130f 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -299,6 +299,32 @@

Failure: badarg if the atom does not already exist.

+ + + Convert from text representation to an integer + +

Returns an integer whose text representation is + Binary.

+
+> binary_to_integer(<<"123">>).
+123
+

Failure: badarg if Binary contains a bad + representation of an integer.

+
+
+ + + Convert from text representation to an integer + +

Returns an integer whose text representation in base + Base is Binary.

+
+> binary_to_integer(<<"3FF">>, 16).
+1023
+

Failure: badarg if Binary contains a bad + representation of an integer.

+
+
Convert a binary to a list @@ -1429,7 +1455,28 @@ os_prompt% {one,new,two,three} - + + + Text representation of an integer + +

Returns a binary which corresponds to the text + representation of Integer.

+
+> integer_to_binary(77).
+<<"77">>
+
+
+ + + Text representation of an integer + +

Returns a binary which corresponds to the text + representation of Integer in base Base.

+
+> integer_to_binary(1023, 16).
+<<"3FF">>
+
+
Text representation of an integer -- cgit v1.2.3