Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need new UDF strreplace
Message
 
 
To
08/05/2007 17:34:37
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01223626
Message ID:
01223915
Views:
12
Hi Mike,

Following code should give you a good starting point
lcStr = "ISA*00*00*ZZ*TEST^"
lcDelim = "*"
lnItem = 3
lnP1 = AT(lcDelim, lcStr, lnItem) + 1
lnP2 = AT(lcDelim, lcStr, lnItem+1) - 1
? STUFF(lcStr, lnP1, lnP2-lnP1+1, "AA")
? STUFF(lcStr, lnP1, lnP2-lnP1+1, "ABCD")
>
>I'm doing a some EDI work these days. I have a need to replace certain fields in certain lines. STREXTRACT is pretty good for providing the content of the 6th "delimited" section of an edi string, but there doesn't appear to be a similar function to overwrite or replace the 6th delimited section. Seems like both sides of a problem rarely get addressed. If you build a seek, do you not need a replace? ;)
>
>I didn't see anything similar on the wiki or in the downloads.
>
>Before I go and write such a function, does anyone already have one?
>
>Thanks
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform