Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with strtran()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00414505
Message ID:
00415151
Views:
20
>>>Rip,
>>>
>>>> It will replace some of them but not all even when the slugs are exactly the same.
>>>
>>>I tend to believe that the slugs are not the same as you think they are.
>>>
>>>strtran() is going to do an exact search for the target text, things like uppercase, lowercase, spaces, carriage returns, linefeeds, rtf codes in the stream will affect your result. You should probably look at the rtf file with the hexedit.app to see if your slugs really are all the same.
>>
>>The rtf codes were the problem. The "slugs" looked fine but when viewed with an RTF editor but when viewed as plain text you could see the rtf codes in there. Thanks every one for the suggestions.
>
>If the RTF codes followed a pattern that could be identified by a regular expression, you might be able to use the VBScript.RegExp object to strip or ignore the RTF codes. Regular expressions elminiation can be done fairly easily using the VBscript.RegExp Execute method, which is used to extract occurances of patterns from a string as a collection, indicating the exact value found, it's location, and size.


I think for purposes here it will be easier to just clean up the rtf codes. They seem to be unneccassary anyway as I took out a bunch and it didn't seem to change the appearance of the document.

I did look into that RegExp object and it seems pretty straightforward and easy to use. I do have one question though. When you talk about a "pattern identified by a regular expression" are you talking about a fixed string. Like say "CEOTitle" or "CompanyName". Or could the ReqExp object be used to parse out say... URL's from a document where the URL's could be different from each other but follow some set of rules.
Rip Ryness
International Falls, MN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform