Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace character expression
Message
From
08/07/2010 02:50:08
 
 
To
08/07/2010 02:43:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01471799
Message ID:
01471813
Views:
46
>>>>>is there a quick way to inspect a text document and change all [1] to [01] and all [2] to [02] etc something along the lines of what i have set up below (which doesn't work) - or should i be looking at another approach altogether?
>>>>>
>>>>>cFile = Filetostr("C:\mytext.txt") 
>>>>>
>>>>>cFile = Strtran(cFile,Chr(202),"E") && using this code i can change only one character at a time
>>>>>
>>>>>cFile = strtran(cFile,"[5]","[05]")  && can i use the same approach for character string - perhaps using chrtran??
>>>>>
>>>>>
>>>>>thanks k
>>>>
>>>>It looks like you may need to use RegEx here. Chrtran will not help. But I'm weak as to writing the correct pattern...
>>>
>>>mmmm i have heard of it in other programmiing platforms but whether there is a vfp equivalent would be useful.
>>>k
>>
>>http://www.sweetpotatosoftware.com/spsblog/SearchView.aspx?q=regex
>
>thanks for the referenece tore - not bedtime reading. since this data is eventually imported into a table, it looks like an easier task would be to catch it once it's imported and replace any single character entries with 0+existing character.

RegEx is a really nice technology, but it is not easy to learn without a good tutor. Personally I only use it a few times, and spent a lot of time with trial and error before I got it working.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform