View Full Version : Convert a string to expression
Harold II
02-12-2004, 06:05 PM
for example, the user input a string of math expression like,
x^2+x+2
how can I convert it to a expression that VB can use to evaluate its value with given x?
Strike
02-12-2004, 06:41 PM
You generally don't want to blindly evaluate arbitrary user input ...
Harold II
02-12-2004, 06:44 PM
but I have to provide that function in my program, anyway.......
and in python it is really easy to do, just use
input(1+1)
and it stores 2 instead of "1+1"
. but how to do this in VB?
manual_overide
03-15-2004, 11:41 PM
you have to do some string processing. this also solves the problem of executing arbitrary user input (sort of)
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.