Help, extracting substrings from a string

This is a discussion on Help, extracting substrings from a string within the C Programming forums, part of the General Programming Boards category; Hi I have a problem on which Iam working on which requires me to extract substrings from a string as ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    39

    Post Help, extracting substrings from a string

    Hi I have a problem on which Iam working on which requires me to extract substrings from a string as below:

    String A(B(A(C(t=0,p>0.1)))) + D(E(t=1,p>0.1))

    Substrings needed are: {A(B(A(C(t=0,p>0.1))))+D(E(t=1,p>0.1)),
    A(B(A(C(t=0,p>0.1)))),
    B(A(C(t=0,p>0.1))),
    A(C(t=0,p>0.1)),
    C(t=0,p>0.1),
    (t=0,p>0.1),
    D(E(t=1,p>0.1)),
    E(t=1,p>0.1),
    (t=1,p>0.1)}

    So in effect i have to be able to get all substrings within the brackets.

    How can I do it in C

    Please help

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Recursive function. Any time you hit a ( call yourself.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 05:30 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 07:02 AM
  3. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  4. "Operator must be a member function..." (Error)
    By Magos in forum C++ Programming
    Replies: 16
    Last Post: 10-28-2002, 02:54 PM
  5. Again Character Count, Word Count and String Search
    By client in forum C Programming
    Replies: 2
    Last Post: 05-09-2002, 12:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21