You do not want to convert from string to number.
What you really want is to EVALUATE arithmetic expressions !
For that you need to either write parser/interpreter or  use external onee
Thanks to AmiBroker JScript support you can use for example JScript eval 
function.


EnableScript("JScript"); 
<% 

%> 

function Evaluate( text ) 
{ 
  so = GetScriptObject(); 
  return so.eval( text ); 
} 

"The result is " + Evaluate("3 + 2"); 

Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: ozzyapeman 
  To: [email protected] 
  Sent: Wednesday, November 26, 2008 11:46 PM
  Subject: [amibroker] Re: How to convert a string to non-string characters?!


  Or to take a more trivial example, the following prints "3" instead of "12":

  VarSetText("Condition1", "3 + 4 + 5"); 

  Total = StrToNum (VarGetText("Condition1")); 

  printf ("Sum %g", Total); 

  How do I convert the above string so that Total is equal to the expression 
itself, which is equal to 12?


  --- In [email protected], "ozzyapeman" <[EMAIL PROTECTED]> wrote:
  >
  > Yes, tried that. But since the values spit out by the function aren't
  > just pure numbers, it does not seem to work.
  >
   

Reply via email to