zeroclickinfo-goodies/lib/DDG/Goodie/Uppercase.pm

44 lines
1.2 KiB
Perl
Raw Normal View History

package DDG::Goodie::Uppercase;
# ABSTRACT: uppercase a provided string.
use strict;
use DDG::Goodie;
triggers start => 'uppercase', 'upper case', 'allcaps', 'all caps', 'strtoupper', 'toupper';
# leaving out 'uc' because of queries like "UC Berkley", etc
# 2014-08-10: triggers to "start"-only to make it act more like a "command"
# resolves issue with queries like "why do people type in all caps"
zci answer_type => "uppercase";
2014-10-07 00:24:08 -07:00
zci is_cached => 1;
primary_example_queries 'uppercase this';
secondary_example_queries 'upper case that';
name 'Uppercase';
description 'Make a string uppercase.';
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/Uppercase.pm';
category 'conversions';
topics 'programming';
attribution twitter => ['crazedpsyc', 'Michael Smith'],
cpan => ['CRZEDPSYC', 'Michael Smith'];
handle remainder => sub {
2014-10-07 00:24:08 -07:00
my $input = shift;
2014-10-28 11:36:15 -07:00
2014-10-07 00:24:08 -07:00
return unless $input;
return if $input eq uc($input);
2014-10-28 11:36:15 -07:00
2014-10-07 00:24:08 -07:00
my $upper = uc $input;
2014-10-07 00:24:08 -07:00
return $upper,
structured_answer => {
input => [html_enc($input)],
operation => 'Uppercase',
2014-10-07 00:24:08 -07:00
result => html_enc($upper),
};
};
1;