aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVladimir Dronnikov <[email protected]>2013-01-25 02:41:06 +0000
committerVladimir Dronnikov <[email protected]>2013-01-25 02:41:06 +0000
commit85fc53be8c2ddbaa264e9eaf071f67a8bcbeffca (patch)
treedcbacbc31c7eb3efd5dcb53503e094d146bca890 /src
parent855e9652fa40673d8f1ff40fd262963941e28fef (diff)
downloadcowboy-85fc53be8c2ddbaa264e9eaf071f67a8bcbeffca.tar.gz
cowboy-85fc53be8c2ddbaa264e9eaf071f67a8bcbeffca.tar.bz2
cowboy-85fc53be8c2ddbaa264e9eaf071f67a8bcbeffca.zip
Expose uppercase binary converter
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_bstr.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cowboy_bstr.erl b/src/cowboy_bstr.erl
index bc6818f..01ed9ae 100644
--- a/src/cowboy_bstr.erl
+++ b/src/cowboy_bstr.erl
@@ -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.