Reverse Integer Erlang

I am looking for an easy way to flip an integer in erlang. Example: 1234 to 4321

+3
source share
1 answer

You can use some of the built-in functions to make this easy.

1> list_to_integer(lists:reverse(integer_to_list(1234))).
4321
+10
source

Source: https://habr.com/ru/post/1761965/


All Articles