mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Merge branch 'expose-to_upper' of git://github.com/dvv/cowboy
This commit is contained in:
commit
ecb234693c
1 changed files with 6 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
%% Binary strings.
|
||||
-export([capitalize_token/1]).
|
||||
-export([to_lower/1]).
|
||||
-export([to_upper/1]).
|
||||
|
||||
%% Characters.
|
||||
-export([char_to_lower/1]).
|
||||
|
@ -51,6 +52,11 @@ capitalize_token(<< C, Rest/bits >>, false, Acc) ->
|
|||
to_lower(B) ->
|
||||
<< << (char_to_lower(C)) >> || << C >> <= B >>.
|
||||
|
||||
%% @doc Convert a binary string to uppercase.
|
||||
-spec to_upper(B) -> B when B::binary().
|
||||
to_upper(B) ->
|
||||
<< << (char_to_upper(C)) >> || << C >> <= B >>.
|
||||
|
||||
%% @doc Convert [A-Z] characters to lowercase.
|
||||
%% @end
|
||||
%% We gain noticeable speed by matching each value directly.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue