Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

Uppercase Text Erl

Luke Bakken edited this page Oct 5, 2016 · 1 revision

Uppercase Text Pre-Commit Hook (Erlang)

Source File on GitHub

This function can be used in a pre-commit hook to force all letters to UPPERCASE in a text document.

-module(uppercase_text).

-export([uppertext/1]).

uppertext(IncomingObject) ->
  BinaryContent = riak_object:get_value(IncomingObject),
  StringContent = binary:bin_to_list(BinaryContent),
  UpperStringContent = string:to_upper(StringContent),
  UpperBinaryContent = binary:list_to_bin(UpperStringContent),
  riak_object:apply_updates(riak_object:update_value(IncomingObject, UpperBinaryContent)).

Clone this wiki locally