Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding an exact match in a string
Message
From
27/10/2019 23:58:22
 
 
To
27/10/2019 18:52:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01671709
Message ID:
01671712
Views:
60
>I am trying to find vars and their values in a string, and am having a hassle with similar var names. The vars are not all constantly in the string - in other words, it's a mixture of the vars, and I have to test to see what vars are in the particular string.
>
>If the string has Var1 and Var10 in it, and I test using $, I get a hit on both, but in the example string below, only Var10 is there
>
>VarString= "Var2=cd, Var3=ef, Var4=gh, Var5=ij, Var6=kl, Var7=mn, Var8=op, Var9=qr, Var10=st"
>
>If I use TestVar $ VarString and in that string it has Var10, for example, I will get a hit when testing for TestVar="Var10" as well as when TestVar="Var1".
>
>How do I eliminate this ambiguity?
>
>I hope I explained that clearly enough...

If you want to eliminate this problem at the source, you could rename your variables to Var01, Var02, ...
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform