Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: The “real length" of UTF8 strings

by gone2015 (Deacon)
on Sep 23, 2008 at 20:30 UTC ( [id://713303]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      print xlen("(\x{5fcd}\x{65e0}\x{53ef}\x{5fcd})"), "\n" ; ;
    
    ...
        while ($s =~ m/[\x{5000}-\x{6FFF}]/g) { $l++ ; } ;
        return $l ;
      } ;
    
  2. or download this
      print ylen("(\x{5fcd}\x{65e0}\x{53ef}\x{5fcd})"), "\n" ; ;
    
    ...
        my ($s) = @_ ;
        return length($s) + ($s =~ tr/[\x{5000}-\x{6FFF}]//) ;
      } ;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://713303]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found