Guidance Forums / wxWidgets (wxWindows) in C++ / wxString toDouble parser

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxString toDouble parser
Posted by: 2004-06-08 06:10:14
I hope someone will help me with this problem:

I want to convert a wxString like "2*sin(x*5)+2" to a double (or long if thats better :-). If I just convert it, nothing happens, because it won't read letters, operators and things like that. I think I need to make a parser or something, but I have no idea how to do so.

It's for an equation grapher, if that could be useful.

Can anybody help me? :-)
Message2. Re: wxString toDouble parser
Posted by: upCASE 2004-06-08 15:14:01
I guess you mean you want to read in a string, compute the expression and give the correct result. Yes, that implies parsing :)
Check it seems to be cool.
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: wxString toDouble parser
Posted by: 2004-06-19 04:42:37

Thank you very much for your answer, upCASE. But I've tried the get the GOLD Parser to work, but I couldn't. Would you or somebody like to help me with some examples, how to compile it, and an example how to parse a wxString, compute the expression and get the result into a double or float.

If thats possible, I think I know how to use the GoldParser ;)
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Thu 2024-6-20  Guidance Laboratory Inc. Hits:0