in reply to Re: Counting text with ligatures
in thread Counting text with ligatures
At least on Perl 5.14 and Perl 5.20, this doesn't work (and I don't understand why):
use strict; use charnames ":full"; my $string = "\N{LATIN SMALL LIGATURE FFI}"; print "length: ",length($string),"\n"; # wrong way my $len = () = $string=~/\X/g; print "len: $len\n"; my @graphs = split /\X\K(?=\X)/, $string; print "graphs: ", 0+@graphs, "\n"; __END__ length: 1 len: 1 graphs: 1
Is maybe our understanding of graphemes different from the separate letters of the ligatures?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Counting text with ligatures
by haukex (Archbishop) on Sep 13, 2017 at 14:02 UTC |