Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String Splitting in Foxpro Visual 9

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.

like image 327
DataMailProcess Avatar asked Jun 07 '26 18:06

DataMailProcess


2 Answers

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

lcColumnData = "City, Zipcode"

? STREXTRACT(m.lcColumnData, "",",")
like image 192
Cetin Basoz Avatar answered Jun 10 '26 09:06

Cetin Basoz


STORE ALINES(aCZ, "Atlanta, 30301", ",") TO iCZ

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

?City
?ZipCode
like image 38
Keht Avatar answered Jun 10 '26 11:06

Keht



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!