aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-02-06 18:52:56 +0100
committerLoïc Hoguin <[email protected]>2013-02-06 18:52:56 +0100
commitecb234693c82553261738c28f883b327a2d586e1 (patch)
tree02494debc8738def7fdc6bf9cd9ac5c79e2e2656 /src
parent8e1bbc2cbc83eef8d01fe39a082a7c0318380326 (diff)
parent85fc53be8c2ddbaa264e9eaf071f67a8bcbeffca (diff)
downloadcowboy-ecb234693c82553261738c28f883b327a2d586e1.tar.gz
cowboy-ecb234693c82553261738c28f883b327a2d586e1.tar.bz2
cowboy-ecb234693c82553261738c28f883b327a2d586e1.zip
Merge branch 'expose-to_upper' of git://github.com/dvv/cowboy
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.