Published on InterSystems Developer Community (https://community.intersystems.com)

Home > $zstrip a variable to separate the city, state and zip

Question
Wesley West · May 20, 2022

$zstrip a variable to separate the city, state and zip

I am looking to separate out a variable into 3 other variables

Basically

S REC="CANTON,TX.,75103"

S ZIP= $ZSTRIP(REC,"*","AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz,.")   RETURNS "75103"

S STA=

S CTY=

I am having trouble stripping the other info, any help would be greatly appreciated and I do realize there is a better way to strip the zip, I just haven't found it yet.

 

Thanks in Advance!

#Caché
Product version: Caché 2017.1

Source URL:https://community.intersystems.com/post/zstrip-variable-separate-city-state-and-zip