[Israel.pm] 8-bit characters recognition
omerz at actcom.co.il
Wed May 19 05:23:53 PDT 2004
On Wed, 19 May 2004, Roman M. Parparov wrote:
> What would be a simple way to recognize if an 8-bit (ord($c) > 0x7f)
> character is present in a string?
1. Don't use pattern matching.
2. If speed is your utmost considration, write a C function to do the job
and invoke it from your Perl script.
IIRC, 80x86 machine language supports this kind of operation by
prefixing an instruction with the rep prefix.
3. If speed is not that big concern, implement a loop which scans the
string character by character, and compare ord(char)&0x80 to zero.
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html
More information about the Perl