Skip to content

Instantly share code, notes, and snippets.

@valinurovam
Created November 5, 2013 18:26
Show Gist options
  • Save valinurovam/7323656 to your computer and use it in GitHub Desktop.
Save valinurovam/7323656 to your computer and use it in GitHub Desktop.
get_country_id_by_dest(0) -> undefined;
get_country_id_by_dest(Msisdn) when is_list(Msisdn) =:= true ->
get_country_id_by_dest(erlang:list_to_integer(Msisdn));
get_country_id_by_dest(Msisdn)->
case ets:lookup(?TCOUNTRY_CODE, Msisdn) of
[{_Code, {_CodeLength, CountryID, _NumLength}}] ->
CountryID;
[] ->
get_country_id_by_dest(Msisdn div 10)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment