CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    1

    Extract commands from a string?

    String => 100abc PLUdef gh 3MULkl(mn4 MINop5q)rMULs6t
    result = 100+3*4-5*6 = 100+12-30 = 82.
    rest = abc def gh kl(mn opq)rst

    I need code that extracts both result and rest from this specific string.

    Recommendations are very welcome!

  2. #2
    Join Date
    May 2008
    Posts
    300

    Re: Extract commands from a string?

    1. a trick for PLU MUL things, since they are less than 4 chars, you can test them as int. like (*(int *)p & 0xFFFFFF) == 'LUM'. some compilers may not support multi-character literals though.

    2. numeric character starts a number, non-numeric ones terminates one.
    Nope

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

Featured