Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need new UDF strreplace
Message
From
09/05/2007 16:04:22
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
 
To
09/05/2007 11:23:30
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:
01223967
Views:
19
Seems to me that if you know that strextract() needs to get the 6th occurance of a string then strtran() should be able to replace only the the 6th occurance.

>Hi James
>
>>Hi Mike. How about this or some variation of it?
>>
>>
>>?strtran(lcvalue,strextract(lcvalue,'var1','var2',...),lcnewval)
>
>Thanks, but I don't think so. :) It's got to be positional. That would overwrite every occurance of that value throughout the string, no?
>
>Given a string with a specified delimiter
>
>ISA*00*00*ZZ*TEST^
>
>remove the ZZ and replace it with MY. It's in the 4th "field" position.
>
>Thanks!
>
>
>>>Hi all
>>>
>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform