Add compile-time switch for OTP-20 string funcs

Allows support for Unicode data, and prevents compile warnings that will
start with OTP-20.
This commit is contained in:
Fred Hebert 2017-11-01 11:26:17 -04:00
parent fa1ec76a9b
commit f8f72b7cc5
4 changed files with 28 additions and 4 deletions

View file

@ -101,7 +101,7 @@ parse(Date, Now) ->
do_parse(Date, Now, []).
do_parse(Date, Now, Opts) ->
case filter_hints(parse(tokenise(string:to_upper(Date), []), Now, Opts)) of
case filter_hints(parse(tokenise(uppercase(Date), []), Now, Opts)) of
{error, bad_date} ->
erlang:throw({?MODULE, {bad_date, Date}});
{D1, T1} = {{Y, M, D}, {H, M1, S}}
@ -728,6 +728,12 @@ pad6(X) when is_integer(X) ->
ltoi(X) ->
list_to_integer(X).
-ifdef(unicode_str).
uppercase(Str) -> string:uppercase(Str).
-else.
uppercase(Str) -> string:to_upper(Str).
-endif.
%%%===================================================================
%%% Tests
%%%===================================================================