Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluating contents of a string

Status
Not open for further replies.

drathbone

Technical User
Jun 11, 2001
39
0
0
GB
Hi,

I'm trying to parse a load of text and have a string that contains the following &quot;if endurance_percent < 50&quot;.

There's loads of these lines that I need to check, but what I need to do is evaluate if the line would be true or false, so if the string X contained the above, is there anyway I can do something like IF X THEN..... ??

I've written the program in Perl and use the EVAL function, but I'm now trying to port it to VB6.

Also, it would prove difficult to pull out the individual parts of the string and evaluate them, as the string may contain numerous checks, like &quot;if endurance_percent < 50 and score = 1 and opponent = weak....&quot;.

Hope someone can help...
Darren Rathbone
 
Hi,

There is no EVAL function in VB (unfortunately). You have a few options, parte the entire file (a paint to program and as you mention not easy for the more complex expressions). Use VBScript or an evaluator (See thread222-1859).

Good Luck [pipe] Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
VB Script Control may be your best friend: have a look at for additional information.

VB scripting contains a EVAL/EXECUTE statements and is pretty much based on Perl's scripting capabilities.

Other usefull information can be found in
VBSCRIPT in a Nutshell
Mat Childs, Paul Lomax & Ron Petrusha
O'Reilly
1-56692-720-6



_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Thanks.

I've no experience with VBSCript, but it sounds the way to go. I presume that there's a control that'll let me use VB Script within a VB 6 application.

Anyway, I'll have a dig around and see what I can come up with.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top