Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple string question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00418746
Message ID:
00418755
Views:
30
Brenda,

Is this what you are looking for? HTH...

Bill



* lcString is the string you want to extract the User ID from

* Variables we will need
LOCAL lnPos, lcTmpString
lcTmpString = ""

* See if USERID is in the string
lnPos = AT("USERID", lcString)
IF lnPos > 0
* USERID is in the string, so take everything after it.
lcTmpString = SUBSTR(lcString, lnPos + LEN("USERID"))

* See if we have any spaces in the string, and only take
* up to the space.
lnPos = AT(" ", lcTmpString)
IF lnPos > 0
* There is a space here, so take everything up to the
* space
lcTmpString = SUBSTR(lcTmpString, 1, lnPos - 1)
ELSE
* There is no space, so the User ID goes to the end of the
* string. Nothing to do.
ENDIF
ENDIF

* At this point lcTmpString is empty if there was no user ID,
* or contains the user ID.
Previous
Reply
Map
View

Click here to load this message in the networking platform