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

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 dat

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: 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* I AM N

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? strlen(preg_replace('/[^[:upper:]]/',

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 Ce

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 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 (h

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 Donal

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 (untest