Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String manipulation
Message
De
15/04/2000 14:20:29
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00359517
Message ID:
00360021
Vues:
13
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform