Determine if a string has all unique characters: Difference between revisions
Determine if a string has all unique characters (view source)
Revision as of 08:22, 12 October 2023
, 7 months ago→Raku: use Bag
(→{{header|Quackery}}: tidied up) |
(→Raku: use Bag) |
||
Line 3,713:
Raku works with unicode natively and handles combining characters and multi-byte emoji correctly. In the last string, notice the the length is correctly shown as 11 characters and that the delta with a combining circumflex in position 6 is not the same as the deltas without in positions 5 & 9.
<syntaxhighlight lang="raku" line=""> -> $str {
my $i = 0;
print "\n{$str.raku} (length: {$str.chars}), has ";
my %m = $str.comb.Bag;
if any(%m.values) > 1 {
say "duplicated characters:";
|