Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INLIST() returning 'wrong' result
Message
From
08/04/2008 17:05:35
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
07/04/2008 20:36:15
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01308878
Message ID:
01309180
Views:
17
This is why I think it's fine to ask questions about things that may seem obvious to others. It's not necessarily the answer to what I was trying to do with a specific command, but the various solutions to a problem. I like this a lot and never would have seen it if I hadn't posted my question. All the other fluff in this thread is crap.

>Try something like
>
>tcName = "Thurston Howell III"
>lcSuffix=ltrim(substr(m.tcName,rat([ ],rtrim(m.tcName))))
>ldoesSuffixExist= INLIST(UPPER(m.lcSuffix),"PHD","II","III","IV","V","JR","SR","ESQ","CPA","CEA","DD","MD","JD")
>
>
>Just fwiw, you need to watch SET EXACT if you want to use INLIST like this- e.g. "Thurston Vanderbilt" will return a .T. if SET EXACT is OFF. There are several ways to make it independent of SET EXACT but here's 2 easy ways:
>
>
>ldoesSuffixExist= ! empty(m.lcsuffix) and ;
>    INLIST(UPPER(m.lcSuffix)+[~],"PHD~","II~","III~","IV~","V~","JR~","SR~","ESQ~","CPA~","CEA~","DD~","MD~","JD~")
>
>
>-or-
>
>ldoesSuffixExist= [~]+upper(m.lcSuffix)+[~] $ [~PHD~II~III~IV~V~JR~SR~ESQ~CPA~CEA~DD~MD~JD~]
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform