Re: extracting string

Discussion in 'C Programming' started by Martien Verbruggen, Jun 26, 2003.

  1. On 25 Jun 2003 22:46:47 -0700,
    qazmlp <> wrote:
    > const char* big = "abcdefgh123" ;
    > const char* small = "bcd" ;
    >
    > Now, I want to extract the remaining string from big, after the small
    > contents.
    > That is the result string should have "efgh123".


    Use strstr(big, small) to find the first occurrence of small in big.
    Add strlen(small) to the returned pointer. The result should now point
    to the 'e' in big (IOW it's a pointer to the substring "efgh123" in
    the string pointed to by big). Since I don't really know what you mean
    by "the result string", and what you want to do with that, I can't
    give you any more advice.

    Martien
    --
    |
    Martien Verbruggen | Freudian slip: when you say one thing but
    Trading Post Australia | mean your mother.
    |
    Martien Verbruggen, Jun 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R
    Replies:
    2
    Views:
    526
    Jon A. Cruz
    Jul 25, 2003
  2. Mar Thomas

    Extracting a string

    Mar Thomas, Sep 26, 2003, in forum: Java
    Replies:
    9
    Views:
    379
    Tony Morris
    Jan 15, 2004
  3. Zoran Cutura

    Re: extracting string

    Zoran Cutura, Jun 26, 2003, in forum: C Programming
    Replies:
    0
    Views:
    717
    Zoran Cutura
    Jun 26, 2003
  4. Ben Pfaff

    Re: extracting string

    Ben Pfaff, Jun 26, 2003, in forum: C Programming
    Replies:
    0
    Views:
    690
    Ben Pfaff
    Jun 26, 2003
  5. CBFalconer

    Re: extracting string

    CBFalconer, Jun 26, 2003, in forum: C Programming
    Replies:
    0
    Views:
    712
    CBFalconer
    Jun 26, 2003
Loading...

Share This Page