Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pull info to right of spaces

Status
Not open for further replies.

EBOUGHEY

Programmer
Aug 20, 2002
143
US
I have a file with address, city state and zip in one field.

I see that there are two spaces before it puts the city, state zip info.

What would the command be to take all the info to the right of the first occurence of two spaces and put it in another field?

Thanks for any assistance.
 
Hi Barbara -

Didn't work.

New field is called csz and field where data is located is called add_csz.

Here's what I typed:

csz = alltrim(substr(add_csz,at(' ',add_csz)))

Sample of data: (Actually 3 spaces)

555 Sunchase Dr Fort Collins, CO 80524-6022
 
REPLACE ALL csz with substr(add_csz,at(' ',add_csz))

This worked though... Thanks for the help!
 
This can be very resource intensive, but it works.

Darrell

? StripDblSpc("555 Sunchase Dr Fort Collins, CO 80524-6022")

FUNCTION StripDblSpc(cTextIn)
cTextIn = ALLT(cTextIn)
DO WHILE SPACE(2) $ cTextIn
cTextIn = STRTRAN(cTextIn,SPACE(2),SPACE(1))
ENDDO
RETURN cTextIn
ENDFUNC
 
When I gave an example using NewField, that was a memory variable. As you discovered, you have to do a replace command to save it to a field, but you left out the alltrim(). You need that, otherwise everything in the new field will start with 2 space.


-BP (Barbara Peisch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top