[PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread zzapper
Hi, Image that there could be a string fred Fred FRED First of all I need to know that these are same which I can do with strtolower, but how could I tell that 'FRED' is 'most captilised? -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Chris Boget
Image that there could be a string fred Fred FRED First of all I need to know that these are same which I can do with strtolower, but how could I tell that 'FRED' is 'most captilised? Iterate through the string and count the number of capitalised letters. You can do something like this

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Greg Donald
On 10/10/05, zzapper [EMAIL PROTECTED] wrote: Image that there could be a string fred Fred FRED First of all I need to know that these are same which I can do with strtolower, but how could I tell $a = array( 'fred', 'Fred', 'FRED' ); sort( $a ); echo $a[ 0 ]; -- Greg Donald Zend

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Mark Rees
Image that there could be a string fred Fred FRED It isn't hard to do. First of all I need to know that these are same which I can do with strtolower Also note strcasecmp for this task - http://uk2.php.net/manual/en/function.strcasecmp.php -- PHP General Mailing List

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Jochem Maas
Greg Donald wrote: On 10/10/05, zzapper [EMAIL PROTECTED] wrote: Image that there could be a string fred Fred FRED First of all I need to know that these are same which I can do with strtolower, but how could I tell $a = array( 'fred', 'Fred', 'FRED' ); sort( $a ); echo $a[ 0 ]; cute

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Greg Donald
On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote: cute - but it doesn't always work e.g.: $a = array( FrEDDie, fREDdIE, FReddie ); sort( $a ); echo $a[ 0 ]; // we want the 2nd item from the unsort array Works for the sample data you first posted. *shrug* -- Greg Donald Zend Certified

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Robin Vickery
On 10/10/05, zzapper [EMAIL PROTECTED] wrote: Hi, Image that there could be a string fred Fred FRED First of all I need to know that these are same which I can do with strtolower, but how could I tell that 'FRED' is 'most captilised? ?php $strings = array( 'fred', 'Fred',

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Greg Donald
On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote: I AM NOT THE OP THANKS, I'm quite capable of solving such a problem without the help of people who don't bother to think beyond 'sample data' ... Yeah, everyone should read minds automatically, I agree. It's bloody obvious that the data in

Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Jochem Maas
Greg Donald wrote: On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote: I AM NOT THE OP THANKS, I'm quite capable of solving such a problem without the help of people who don't bother to think beyond 'sample data' ... Yeah, everyone should read minds automatically, I agree. I guess reading