[RESOLVED] How do I return groups of numbers or characters from a string?
I'm writing a graphing calculator right now, and I need to be able to read an equation (i.e. [y1= 6x/3x^2] or [y2= (2x + 4)(3 - 2x^2)]) and return it as a very simplified equivalent function (i.e. [y1= 2x^-1] or [y2= -4x^3 - 8x^2 + 6x + 12]). I just need to know how to go about identifying the groups of numbers/operators/variables, and it should be much easier from there.
Also, if the coefficient, variables, and exponents could be returned as separate variables, this would be a ton easier. Thanks!
EDIT: I'm writing this as a callable function like this, where 'eqtn' is only the right side of an equation, like this: (the bold) y1= 3x + 2
Code:
Private Function getEquation(ByRef eqtn As String)
End Function
Thank you!
Re: How do I return groups of numbers or characters from a string?
Re: How do I return groups of numbers or characters from a string?
Re: How do I return groups of numbers or characters from a string?
dbasnett,
Unfortunately, I'm pretty new to VB, having started only a few months ago. I've gotten my way around it though, (even writing a ten-line factorizing program from scratch! (I don't know how impressive this is, but it was pretty cool to me)) and am really just trying to teach myself as I go and encounter new problems. I did take a look at the article you linked, but it's beyond me. Thanks!
Re: How do I return groups of numbers or characters from a string?
4x2y,
Thanks, I feel like this will come in very handy. Is there anything I need to import into my code for this to work though? I can't declare variables as an "evaluator", because it isn't supported as a type by default.
Re: How do I return groups of numbers or characters from a string?
Add the two files Evaluator.vb and EvalFunctions.vb to your project
Re: How do I return groups of numbers or characters from a string?