2014-06-15 02:57:34 -07:00
|
|
|
package DDG::Goodie::Uppercase;
|
2014-08-20 11:45:33 -07:00
|
|
|
# ABSTRACT: uppercase a provided string.
|
|
|
|
|
2015-02-22 12:09:29 -08:00
|
|
|
use strict;
|
2014-06-15 02:57:34 -07:00
|
|
|
use DDG::Goodie;
|
|
|
|
|
2014-08-10 11:23:48 -07:00
|
|
|
triggers start => 'uppercase', 'upper case', 'allcaps', 'all caps', 'strtoupper', 'toupper';
|
2014-07-23 14:44:51 -07:00
|
|
|
# leaving out 'uc' because of queries like "UC Berkley", etc
|
2014-08-10 11:23:48 -07:00
|
|
|
# 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"
|
2014-06-15 02:57:34 -07:00
|
|
|
|
|
|
|
zci answer_type => "uppercase";
|
2014-10-07 00:24:08 -07:00
|
|
|
zci is_cached => 1;
|
2014-06-15 02:57:34 -07:00
|
|
|
|
|
|
|
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';
|
|
|
|
|
2015-01-07 10:24:47 -08:00
|
|
|
attribution twitter => ['crazedpsyc', 'Michael Smith'],
|
|
|
|
cpan => ['CRZEDPSYC', 'Michael Smith'];
|
2014-06-15 02:57:34 -07:00
|
|
|
|
2014-07-23 14:44:51 -07:00
|
|
|
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;
|
2015-02-27 14:58:41 -08:00
|
|
|
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-07-23 14:44:51 -07:00
|
|
|
|
2014-10-07 00:24:08 -07:00
|
|
|
return $upper,
|
|
|
|
structured_answer => {
|
|
|
|
input => [html_enc($input)],
|
2015-01-09 00:09:45 -08:00
|
|
|
operation => 'Uppercase',
|
2014-10-07 00:24:08 -07:00
|
|
|
result => html_enc($upper),
|
|
|
|
};
|
2014-07-23 14:44:51 -07:00
|
|
|
};
|
|
|
|
|
2014-08-10 11:23:48 -07:00
|
|
|
1;
|