This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-author("mlersch"). | |
-module(currency). | |
-export([test/0, convert/1]). | |
convert(V) when is_binary(V) -> convert(binary_to_list(V)); | |
convert(V) when is_float(V) -> round(V*100); | |
convert(V) when is_integer(V) -> V*100; | |
convert(V) when is_list(V) -> | |
V1 = re:replace(re:replace(V, "[^0-9 ^, ^.]", "", [{return,list},unicode,global]), "\\h", "", [{return,list},global]), |