Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String manipulation
Message
From
15/04/2000 14:20:29
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00359517
Message ID:
00360021
Views:
15
>Hi everybody,
>
>I understand, that this question should have a simple answer, but I stuck :( Could somebody help me?
>
>The problem is:
>
>I have a string, say,
>myString='Nadya, are you totally lost??!!! : <>>>>>'
>
>I have several symbols, like:
>symbols=[:;./\<>+=-}]()#*]
>
>I want to surround these symbols with space(1)+symbol+space(1), for each occurance of these symbols in my string.
>
>How can I do that?

The easiest way would be using a regular expression parser; look into the VBScript.RegExp object from the WSH:

oRegExp = CREATEOBJ('VBScript.RegExp')
oRegExp.Global = .T.
oRegExp.Pattern = "([:;.=])" && the others are doable but require special syntax
MyFixedString = oRegExp.Replace(mystring," $1 ")
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
Next
Reply
Map
View

Click here to load this message in the networking platform