Results 1 to 7 of 7

Thread: [RESOLVED] How do I return groups of numbers or characters from a string?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2013
    Posts
    22

    Resolved [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!
    Last edited by DinosaurusRex; Oct 29th, 2013 at 05:35 PM.

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: How do I return groups of numbers or characters from a string?

    How good are you at VB? Take a look at http://en.wikipedia.org/wiki/Shunting_yard_algorithm
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: How do I return groups of numbers or characters from a string?




  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2013
    Posts
    22

    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!
    Last edited by DinosaurusRex; Oct 29th, 2013 at 06:24 PM.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2013
    Posts
    22

    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.

  6. #6
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    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



  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2013
    Posts
    22

    Re: How do I return groups of numbers or characters from a string?

    Great, thanks so much!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width