Abbreviations, easy: Difference between revisions
m
→{{header|Perl 6}}: Style tweaks, error trapping
m (added a related task.) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Style tweaks, error trapping) |
||
Line 470:
my %abr = '' => '', |$/.map: {
my $abbrv =
|map { $abbrv.substr( 0, $_ ) => $abbrv.uc },
};
sub abbr-easy ( $str ) { %abr{$str.trim.fc} // '*error*' }
# Testing
Line 487:
Input:
Output: </pre>
=={{header|Python}}==
|