1
votes

I have a column of strings separated by comma.

Example: City, Zipcode

I want to make a column with only city populated so everything before the comma.

How has anyone else accomplished this? I know with Foxpro you can usually accomplish the same task various ways. Any help would be appreciated.

EDIT: SOLUTION

GETWORDNUM(FIELD,1,",")

This worked to give the text string before the comma from the column FIELD.

2

2 Answers

4
votes

The easiest way to do that is to use STREXTRACT(). ie:

lcColumnData = "City, Zipcode"

? STREXTRACT(m.lcColumnData, "",",")
0
votes
STORE ALINES(aCZ, "Atlanta, 30301", ",") TO iCZ

City = aCZ[1]
ZipCode = aCZ[2]

?City
?ZipCode