This here produces the correct result on string, number, and comparison results:
I'm happy.
Uses "Console"
Uses "Eval"
PrintL Evaluate("Str$(1 = 1)")
PrintL Evaluate("1=0")
PrintL Evaluate("""1""")
PrintL Evaluate("Format$(Len(Parse$(""hello, world"","" "", 1)))")
PrintL Evaluate("Parse$(""hello, world"","" "", 1)))")
PrintL Evaluate("15>5")
PrintL Evaluate("15+sin(15)/(10^2)")
WaitKey
Function Evaluate(strng As String) As String
Dim expression, original As String
expression = ("Str$(" & strng & ") & """"")
expression = Eval_String(expression)
original = Eval_String(strng)
If Format$(Val(Trim$(original))) <> Trim$(original) Then Return original
Return expression
End Function
Bookmarks