Re: [PHP] Parsing Strings

2008-12-07 Thread German Geek
Why not preg_split ( http://nz.php.net/manual/en/function.preg-split.php ): $str = 'SCOTTSDALE, AZ 85254'; $ar = preg_split('/,? ?/', $str); //optional comma, followed by optional space // $ar = array('SCOTTSDALE', 'AZ', '85254'); On Sat, Dec 6, 2008 at 1:18 PM, Jason Todd Slack-Moehrle < [EMAIL

Re: [PHP] Parsing Strings

2008-12-06 Thread Nathan Rixham
tedd wrote: At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote: How might I also parse and address like: SCOTTSDALE, AZ 85254 It has a comma and a space -Jason On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote: OK, making good learning progress today. I have a string that is

Re: [PHP] Parsing Strings

2008-12-06 Thread VamVan
u can use split() or explode (). Thanks On Sat, Dec 6, 2008 at 9:27 AM, tedd <[EMAIL PROTECTED]> wrote: > At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote: > >> How might I also parse and address like: SCOTTSDALE, AZ 85254 >> >> It has a comma and a space >> >> -Jason >> >> On Dec 5, 200

Re: [PHP] Parsing Strings

2008-12-06 Thread tedd
At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote: How might I also parse and address like: SCOTTSDALE, AZ 85254 It has a comma and a space -Jason On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote: OK, making good learning progress today. I have a string that is: Jason Slack

AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Oups, sorry mistake by copy & paste ;-) On Sa 06.12.2008 01:30 Jason wrote: > Can you explain how to do an address now into City, State, Zip > Like: cortland, ny 13045 $string = "cortland, ny 13045"; $search = array(", ", ","); $replace = array(" ", " "); $newString = str_rep

Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle
Conny, Can you explain how to do an address now into City, State, Zip Like: cortland, ny 13045 $string = "cortland, ny 13045"; $search = array(", ", ","); $replace = array(" ", " "); $newString = str_replace($search, $replace, $string); $array = explode(" ", $newString); Ah ha! Nice that ma

AW: AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Hi, On Sa 06.12.2008 01:30 Jason wrote: > Can you explain how to do an address now into City, State, Zip > Like: cortland, ny 13045 Test this: $string = "cortland, ny 13045"; $search = array(", ", ","); # if there is no space after the comma, we make this ;-) $replace = array(" ", " "); $newStr

Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle
Konrad, On Dec 5, 2008, at 4:22 PM, Konrad Priemer wrote: $array = explode(" ", "Jason Slack"); Awesome, thanks, yup that does it. Can you explain how to do an address now into City, State, Zip Like: cortland, ny 13045 It has a comma and a space! -Jason -- PHP General Mailing List (htt

AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Hi, Jason wrote: > I have a string that is: Jason Slack > and I want it broken at the space so i get Jason and then Slack explode or split can do this. $array = explode(" ", "Jason Slack"); Array ( [0] => Jason [1] => Slack ) Greetings from Stuttgart Conny --- Firma Konrad Priemer O

Re: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle
How might I also parse and address like: SCOTTSDALE, AZ 85254 It has a comma and a space -Jason On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote: OK, making good learning progress today. I have a string that is: Jason Slack and I want it broken at the space so i get Jason and the

[PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle
OK, making good learning progress today. I have a string that is: Jason Slack and I want it broken at the space so i get Jason and then Slack I am looking at parse_str, but I dont get how to do it with a space. The example is using []=. Then I want to assign like: $fname = "Jason"; $lname

Re: [PHP] Parsing Strings

2007-10-15 Thread Philip Thompson
On 10/15/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > > Philip Thompson wrote: > > ... > > $str = 'thisIsAStringIHave'; > > echo ucfirst(preg_replace('/([A-Z])/', ' $1', $str)); > ?> > > HTH Ha! I knew there was a much easier way. My brain is still not working this Monday morning

Re: [PHP] Parsing Strings

2007-10-15 Thread Richard Heyes
Philip Thompson wrote: > ... HTH -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Parsing Strings

2007-10-15 Thread Andrew Ballard
On 10/15/07, Philip Thompson <[EMAIL PROTECTED]> wrote: > Hi. > > Before I try and reinvent the wheel, I thought I'd query the list. I want to > take this string: > > thisIsAStringIHave > > and turn it into: > > This Is A String I Have > > Essentially, I want to capitalize the first letter (ucfirst

[PHP] Parsing Strings

2007-10-15 Thread Philip Thompson
Hi. Before I try and reinvent the wheel, I thought I'd query the list. I want to take this string: thisIsAStringIHave and turn it into: This Is A String I Have Essentially, I want to capitalize the first letter (ucfirst) and then put a space in front of each uppercase letter. I didn't find a P