Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing extra spaces in MIDDLE of str.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00535205
Message ID:
00535732
Views:
19
>>>>This will remove occurances of multiple spaces.
>>Harumph! Can't FoxTools' REDUCE function do this?? I know I can do it with VBScript.RegExp:
>>
>>
oReg = CREATEOBJ('VBScript.RegExp')
>>oReg.Global = .T.             && FOR ALL OCCURANCES
>>oReg.Pattern = '\b[\t ]+\b'   && Match any occurance of one or more spaces/tabs
>>cReducedString = oReg.Replace(cUnReducedString,' ') &&Replace match with ' '
>
>< g >Well, and unbeknownst to me, it looks like it can. I just tried:
lcstring = "John " + CHR(9) + " Smith"
>? lcstring && Prints John       Smith
>? Reduce(lcstring) && Prints John Smith
So apparently it can (at least in 6.0). Also placed multiple occrences of the tab and spaces between them and it still worked. **Braaaaaaaaaaaack**< sticks tongue out at Ed >:-)

Hey, I'm not the one who's a member of the FoxTools and Dark Beer club...they're gonna take away yer beer for this for a week!
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