Abbreviations, easy: Difference between revisions

m
→‎{{header|Perl 6}}: Style tweaks, error trapping
m (added a related task.)
m (→‎{{header|Perl 6}}: Style tweaks, error trapping)
Line 470:
 
my %abr = '' => '', |$/.map: {
my $abbrv = $_.[0].Str.fc;
|map { $abbrv.substr( 0, $_ ) => $abbrv.uc },
$_.[0][0].Str.chars .. $abbrv.chars
};
 
sub abbr-easy ( $str ) { %abr{$str.trim.fc} // '*error*' }
 
# Testing
Line 487:
Input:
Output: </pre>
 
 
=={{header|Python}}==
10,333

edits