Re: Checking how many letters are in a string.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 6:39 PM +0200 3/19/08, Dotan Cohen wrote:
I need to count how many Hebrew characters a given string has. I have
been checking, character by character, if the given character is a
[ý??] and if so I simply ++ the counting variable. It turns out that
this is rather resouce intensive, and I may need a better way of doing
this. I have looked at count_chars and considered writing a wrapper
function for each of the 27 letters of the Hebrew alphabet, but I am
quite sure that there is a cleverer method. Any ideas?

Dotan Cohen


Dotan:

Are you using mb_<whatever> functions?

Hebrew characters are not ASCII and as such may contain graphemes and ligatures. You need to use Unicode safe routines (i.e., mb_strlen() etc. ) for string manipulations.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux