Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simple string question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00418746
Message ID:
00418755
Vues:
29
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform