Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple string question
Message
From
20/09/2000 22:06:43
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00418746
Message ID:
00418837
Views:
27
>>>Assume you have information in MyString and sure that USERID is there:
>>>TempSting = SUBSTR(MyString, ATC('USERID', MyString)+LEN('USERID'))
>>>Result = LEFT(TempSting, AT(' ', TempSting) - 1)
>>>
>>
>>Vlad: When I tried your code I got an empty string returned for the second test condition ("USERIDAA" at end of MyString). Changing 2nd line to
>>
>>Result = LEFT(TempSting, AT(' ', TempSting + " ") - 1)
>>
>>seemed to work
>>
>>............Rich
>
> Correct. I assumed that space always exist in string.

The Vbscript.RegExp object shoud handle this:
oRegExp = CREATEOBJ('vbscript.regexp')
oRegExp.global = .t.
oRegExp.Pattern = '\sUSERID\w{2}\s'
oMatches = oRegExp.Execute(' USERID 1 USERIDAA USER32 USERID99 USERID42')
FOR EACH Match in oMatches
   ? Match.Value
ENDFOR
>
>>
>>>>I have a string that has ' USERID?? ' somewhere in the string. i want returned the characters directly after the USERID and before the next space or at end of string. 'the is USERIDABC code' I want ABC. 'The USERIDAA' I want AA.
>>>>
>>>>As always, I have a terrible time with string functions. Have been looking in my Help Character Function Favorites now for 30 minutes and only have a hodge podge of silly looking code.
>>>>
>>>>Thanks
>>>>
>>>>Brenda
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