AIL PROTECTED]>
Sent: Wednesday, August 20, 2003 5:44 PM
Subject: Re: [PHP] String parsing help
> From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> > From: "Matt Matijevich" <[EMAIL PROTECTED]>
> > > I have have a string that I need to split into 3 di
Or (untested):
$String = 'NORTH LITTLE ROCK AR 72118-5227';
$Bits = split(strrev($String), '[[:space:]]+', 3);
$Zip = strrev($Bits[0]);
$State = strrev($Bits[1]);
$City = strrev($Bits[2]);
...could also use preg_split()
- steve
At 4:44 PM -0400 8/20/03, "CPT John W. Holmes"
<[EMAIL PROTECTED
From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> From: "Matt Matijevich" <[EMAIL PROTECTED]>
> > I have have a string that I need to split into 3 different variables:
> > City,State, and Zip. Here is a couple examples of the strings I need to
> > parse:
> >
> > ANCHORAGE AK 99507-6420
> > JUNEAU
$vector=split( " ", $string, );
$City=$vector[0];
$State=$vector[1];
$Zip=$vector[2]:
This will not work because there cases where the city name have more than 1
word
you must get from end-to-begining
i can't think about it now, but it's a tip anyway
> $vector=split( " ", $string, );
>
>
> $Ci
* Thus wrote Matt Matijevich ([EMAIL PROTECTED]):
> I have have a string that I need to split into 3 different variables:
> City,State, and Zip. Here is a couple examples of the strings I need to
> parse:
>
> ANCHORAGE AK 99507-6420
> JUNEAU AK 99801
> NORTH LITTLE ROCK AR 72118-5227
>
> D
$vector=split( " ", $string, );
$City=$vector[0];
$State=$vector[1];
$Zip=$vector[2]:
- Original Message -
From: "Matt Matijevich" <[EMAIL PROTECTED]>
To: "<" <[EMAIL PROTECTED]>
Sent: Wednesday, August 20, 2003 5:11 PM
Subject: [PHP] String parsing help
> I have have a string that I
6 matches
Mail list logo