oh no, god no!
big misunderstanding, sorry for not being clear i know what parsing is, and how to get a single number from a string (way past that kind of parsing, new here, not to java [URL="http://matrixpeckham.googlepages.com/gravitysimulator"]some of my work[/URL]), i am trying to do something way more complex than that...
say i want to find the value of "2*(3+9x)" when previously x is defined as 2. for you and me it is easy the value is easily found to be 42, but making Java do it is complex and that is what i am trying to parse, i thought i explained well enough but maybe not
all of my google searches for "writing a math parser" turn up parser generating programs(especially if java is included with the search, if not it's all C++), but i want to write my own.
I don't see how that's any different from parsing a string or char...
In this case, you simply need to have a global scoped variable that "reads" x--
int x = 0;
--and if you're using this as a graph or differential, you simply need to make a variable alligned with x--
char xChar = 'x'--
and do a comparison after iterating through the characters in the string and locating x--
char[] myCharArray = "2*(3+9x)".toCharArray();
for(int i = 0; i < myCharArray.length; i++)
{
if(myCharArray[i].equals(xChar))
{
myCharArray[i] = (char)x;
//should cast the value of x into a char then …