Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AT() Function
Message
 
To
20/11/1996 10:41:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00012891
Message ID:
00012897
Views:
22
>>lcLoginString = "jpaskett,ADMINISTRATOR,*******"
>>
>>this.cUserName = LEFT(lcLoginString, AT(",", lcLoginString) - 1)
>>this.cUserLevel = SUBSTR(lcLoginString, AT(",", lcLoginString) + 1)
>>this.cUserLevel = LEFT(this.cUserLevel, AT(",", this.cUserLevel) - 1)
>>
>
>Try:
>
>nFirstComma = At(',', lcLongString, 1)
>nSecondComma = At(',', lcLongString, 2)
>This.cUserName = Substr(lcLongString, 1, nFirstComma - 1)
>This.cUserLevel = Substr(lcLongString, nFirstComma + 1, nSecondComma - 1)
>This.cUserLevel = Substr(lcLongString, nSecondComma + 1)

Alexandre,

If I'm not mistaken, doing this in my command window returns me the following;

nFirstComma = 9
nSecondComma = 23

FirstName works fine, however;
This.cUserLevel = Substr(lcLongString, nFirstComma + 1, nSecondComma - 1)
will return 'ADMINISTRATOR,****'

This.cUserLevel = Substr(lcLongString, nSecondComma + 1)

will return '****' because we are starting at the second comma and returning the remainder of the string.
But if I used the following it should give me what I want;

This.cUserLevel = LEFT(cUserLevel, AT(',', cUserLevel) - 1)

The code I have originally works fine, but I want to avoid, as much as possible, the amount of times the program has to evaluate and redefine this value.

Thanks,
Jon
Jon Paskett

Microsoft Certified Systems Engineer
We all have to start somewhere...
Sometimes over again!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform