Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with removing something from string
Message
From
28/01/2001 09:42:45
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00469416
Message ID:
00469500
Views:
35
>>>
>>>I'd like the analogue of strtran but with case insentitive. Anyway, I've just checked the form code and found, that I always use the same convention: SiteMstr, PropMstr, TranMstr, so this is not a problem.
>>
>>With strtran() this would work :
>>lcString = strtran(upper(lcString), 'SITEMSTR', 'SiteMstr')
>>Cetin
>
>Cetin,
>
>Don't understand, why do you suggest me this?
>
>Let's describe the problem again (which turns to be not a problem, since I use the same name convention in the form, but anyway): I have a string. I want to remove something from the string (table aliases), but preserve the original string (not make it upper or low). IOW, I'd like to remove [SiteMstr.] from the string, [TranMstr.] from the string and [PropMstr.] from the string. Suppose, I don't follow the same rule in my code, so [SiteMstr] could be spelled differently:
>[SITEMSTR], {Sitemstr] [sitemstr], etc. All possible variations...
>
>I guess, only RegExp can help me here. Unfortunately, George and ED's article is still "Coming soon", and since it turns to be not a problem, I'd better wait for this article to come (Yes, I'm a lazy person]...

While VBScript.RegExp does make this relatively easy, it's by no stretch of the imagination the sole way to approach this; a loop could be written using ATC() to find the string and STUFF() to replace the match in-line could be written. And I would not expect that one article on VBScript.RegExp is going to provide comprehensive illumination of what the exact capabilities will be; the only 'hard' thing is the pattern, and the only way to learn it is to use the tool and experiment to get a feel for how to properly construct the pattern, based on both what you're trying to match, and any required detail that has to be preserved inside the actual match. The article is only going to cover the surface of the object with a few simple examples of some practical applications, I could probably write a book just on the regular expression pattern syntax.

IOW, don't wait on the article; you've already seen examples of two of the three methods (Replace and Execute, Test just checks to see if a pattern match is found in the target string) and all the properties. You'll have to learn about how to construct patterns through hands-on application.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform