Re: Checking how many letters are in a string.

From: Date: Wed, 19 Mar 2008 19:29:11 +0000
Subject: Re: Checking how many letters are in a string.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-271844@lists.php.net to get a copy of this message
On 19/03/2008, TG <tg-php@gryffyndevelopment.com> wrote: > > Is the question: > > "How do I tell how many characters are in a string that may contain Hebrew > characters?" > > or is the question... > > "How do I tell how many Hebrew characters are in a string that may contain Hebrew and > non-Hebrew characters.. but I only want a count of the Hebrew characters?" > > or maybe even... > > "How do I tell if there are Hebrew characters in a string? Regardless of actual > count?" > > > The mb_strlen() sounds like it would work for the first question, but that's not exactly > what you asked. What you asked was closer to the second question, which wouldn't be solved by > using mb_strlen() I believe. In the second two cases, you might be able to use a preg_match type > search. > > If no other functions work, you could parse the string into an array and compare against an > array containing hebrew characters. > > > -TG I am asking the second question: how many Hebrew characters in a string that _very_likely_ contains other characters as well. The array suggestion sounds about what I am doing: checking if each letter is a Hebrew character. I will also look into the mb_ functions. I did not know about them before. Thanks. Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?

« previous php.general (#271844) next »