Packages

A RFC-3986 URI Library for parsing and building URIs

Current section

6 Versions

Jump to

Compare versions

3 files changed
+19 additions
-15 deletions
  @@ -1,5 +1,5 @@
1 1 {<<"name">>,<<"urilib">>}.
2 - {<<"version">>,<<"0.2.0">>}.
2 + {<<"version">>,<<"0.3.0">>}.
3 3 {<<"requirements">>,#{}}.
4 4 {<<"app">>,<<"urilib">>}.
5 5 {<<"maintainers">>,[<<"Gavin M. Roy">>]}.
  @@ -1,6 +1,6 @@
1 1 {application,urilib,
2 2 [{description,"A RFC-3986 URI Library for parsing and building URIs"},
3 - {vsn,"0.2.0"},
3 + {vsn,"0.3.0"},
4 4 {licenses,["BSD"]},
5 5 {links,[{"Github","https://github.com/gmr/urilib"}]},
6 6 {maintainers,["Gavin M. Roy"]},
  @@ -321,16 +321,20 @@ url_maybe_add_fragment(Value, URL) ->
321 321 -spec hex_to_upper(string()) -> string().
322 322 %% @private
323 323 hex_to_upper(Value) ->
324 - hex_to_upper(Value, [], []).
325 - hex_to_upper([], [], Value) ->
326 - Value;
327 - hex_to_upper([], Hex, Value) ->
328 - lists:append(Value, string:to_upper(Hex));
329 - hex_to_upper([37|T], [], Value) ->
330 - hex_to_upper(T, [37], Value);
331 - hex_to_upper([H|T], [], Value) ->
332 - hex_to_upper(T, [], lists:append(Value, [H]));
333 - hex_to_upper(Remaining, Hex, Value) when length(Hex) == 3 ->
334 - hex_to_upper(Remaining, [], lists:append(Value, string:to_upper(Hex)));
335 - hex_to_upper([H|T], Hex, Value) ->
336 - hex_to_upper(T, lists:append(Hex, [H]), Value).
324 + hex_to_upper(Value, []).
325 + hex_to_upper([], Accum) ->
326 + lists:reverse(Accum);
327 + hex_to_upper([$%, B1, B2|T], Accum) ->
328 + hex_to_upper(T, [to_upper(B2), to_upper(B1), $% | Accum]);
329 + hex_to_upper([H|T], Accum) ->
330 + hex_to_upper(T, [H | Accum]).
331 +
332 +
333 + -spec to_upper(char()) -> char().
334 + to_upper($a) -> $A;
335 + to_upper($b) -> $B;
336 + to_upper($c) -> $C;
337 + to_upper($d) -> $D;
338 + to_upper($e) -> $E;
339 + to_upper($f) -> $F;
340 + to_upper(C) -> C.