RE: [PHP] Capitalizing the first letter

2007-03-15 Thread Ford, Mike
On 14 March 2007 08:25, Richard Lynch wrote: On Tue, March 13, 2007 9:10 am, Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. No, you don't. :-) You *think* you want to write that function, but this is one of

Re: [PHP] Capitalizing the first letter

2007-03-15 Thread Tijnema !
On 3/15/07, Ford, Mike [EMAIL PROTECTED] wrote: On 14 March 2007 08:25, Richard Lynch wrote: On Tue, March 13, 2007 9:10 am, Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. No, you don't. :-) You *think* you

Re: [PHP] Capitalizing the first letter

2007-03-14 Thread Richard Lynch
On Tue, March 13, 2007 9:10 am, Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. No, you don't. :-) You *think* you want to write that function, but this is one of those things that is *way* more complicated than it

[PHP] Capitalizing the first letter

2007-03-13 Thread Todd Cary
I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? Thank you... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Dave Goodchild
ucwords(strtolower($string)) or ucfirst(strtolower($string)) On 3/13/07, Todd Cary [EMAIL PROTECTED] wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? Thank you... -- PHP

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Stut
Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? ?php $txt = ralph SMith; $txt = ucwords(strtolower($txt)); ? Thank you... You're welcome. -Stut -- PHP

RE: [PHP] Capitalizing the first letter

2007-03-13 Thread Chris Boget
I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? It may not be the most efficient way of accomplishing this, but you could do something like: $string = 'SMith' $fixedString =

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Jochem Maas
Todd Cary wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? // filter? echo ucfirst(strtolower(SMith)); // or echo ucwords(strtolower(ralph a. SMith)); // with regard to

RE: [PHP] Capitalizing the first letter

2007-03-13 Thread Edward Kay
I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? $bar = ucwords(strtolower($bar)); This is an example on the manual page for ucwords. How hard did you look? Edward -- PHP General

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Steve
For your filter to return only/no digits, I would recommend doing a bit of reading on preg_replace ( http://us2.php.net/preg_replace ) while noting the following flags: \d Matches any decimal digit; this is equivalent to the class [0-9]. \D Matches any non-digit character; this is equivalent

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Todd Cary
Chris Boget wrote: I would like to write a filter that takes the text smith or SMith and returns Smith; same for ralph smith. Is the a good source on using filters this way? It may not be the most efficient way of accomplishing this, but you could do something like: $string = 'SMith'

Re: [PHP] Capitalizing the first letter

2007-03-13 Thread Todd Cary
Steve wrote: For your filter to return only/no digits, I would recommend doing a bit of reading on preg_replace ( http://us2.php.net/preg_replace ) while noting the following flags: \d Matches any decimal digit; this is equivalent to the class [0-9]. \D Matches any non-digit character; this

RE: [PHP] Capitalizing the first letter

2007-03-13 Thread Peter Lauri
Thank you! I did not know about the ucwords() functions, and it does not need the string set to lower case. Now to create a filter that returns only numbers (e.g. a1234z - 1234) and the same for non-numbers. [Peter Lauri - DWS Asia] This to replace all non-digit characters with