Everything is in english. But to generalize it, I'm trying to count the number 
of times certain characters appear in a string.

Using char_length instead of just length will guard against double byte characters being counted more than once when determining string length. But it still seems to boil down to a very easy grep statement, but a complicated SQL statement.

----- Original Message ----- From: "Reinhardt Christiansen" <[EMAIL PROTECTED]>
To: "Brent Baisley" <[EMAIL PROTECTED]>; <mysql@lists.mysql.com>
Sent: Thursday, May 31, 2007 2:41 PM
Subject: Re: Determining number of vowels in a string



----- Original Message ----- From: "Brent Baisley" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Thursday, May 31, 2007 1:50 PM
Subject: Determining number of vowels in a string


I'm trying to do a select that will return the number of vowels/consonants present in a string for each record. I thought a simple grep was the way to go, but it appears the grep functions only tell you if a string is present. I would even settle for a grep replace. Just replace the vowels with nothing and determine how the string length changed.

Any ideas? I'm using v4.1.

I'd rather do it in a sql statement rather than using a scripting language.

Is your text always in English? Recognizing vowels in other languages and scripts could be very difficult; for instance, I'm not sure if Japanese even has the _concept_ of vowels or consonants. And even in English, "y" is sometimes considered a vowel and sometimes a consonant. At least it was when I was in primary school way back when.

--
Rhino


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to