View Full Version : [C] converting a string
johnlouis
March 26th, 2007, 04:17 AM
how do i convert a string, "1 + 13 / 4 * 2 - 10", to a computable format, where the integers become type int and the operators remain as char so i could then display the output of that equation?
Templarian
March 26th, 2007, 09:17 AM
http://www.kirupa.com/forum/showthread.php?t=251592
That should give you an idea of what to do. Regex and everything should be simular (may have a few differences).
If you know C it shoudn't take to long to convert.
broneah
March 29th, 2007, 11:11 AM
Not sure what regular expressions have to do with converting a string to an evaluated expression...but the correct way is is to use the eval method.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuidatabinderclassevaltopic1.asp
TheColonial
April 8th, 2007, 05:53 AM
Not sure what regular expressions have to do with converting a string to an evaluated expression...but the correct way is is to use the eval method.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuidatabinderclassevaltopic1.asp
That's completely wrong. This question is about the C language, which has nothing to do with Managed C++ extensions using .NET.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.