Don't use string:take, as it isn't available in Erlang/OTP 19.3 (#3256)

This commit is contained in:
Badlop 2020-05-07 16:08:32 +02:00
parent e5a2d42484
commit edf5b3c7f0
1 changed files with 2 additions and 3 deletions

View File

@ -494,9 +494,8 @@ get_sort_query(Q) ->
end.
get_sort_query2(Q) ->
{value, {_, String}} = lists:keysearch(<<"sort">>, 1, Q),
{StringClean, _} = string:take(String, [$/], true),
Integer = binary_to_integer(StringClean),
{value, {_, Binary}} = lists:keysearch(<<"sort">>, 1, Q),
Integer = list_to_integer(string:strip(binary_to_list(Binary), right, $/)),
case Integer >= 0 of
true -> {ok, {normal, Integer}};
false -> {ok, {reverse, abs(Integer)}}