Reverse String in Erlang

Published on 28 April 2022 (Updated: 25 September 2022)

Reverse String in Erlang

Welcome to the Reverse String in Erlang page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

-module(reverse_string).
-export([start/1]).

-spec start(StringOrAtom :: list() | atom() | integer()) -> 
   list() | atom() | integer().
%%--------------------------------------------------------------------
%% Reverse a given string, atom, or integer
%%--------------------------------------------------------------------
start(String) when is_list(String)  ->
   lists:reverse(String);

start(Atom) when is_atom(Atom) ->
   list_to_atom(lists:reverse(atom_to_list(Atom)));

start(Number) when is_integer(Number) ->
   list_to_integer(lists:reverse(integer_to_list(Number))).

Reverse String in Erlang was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.