Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: extracting string

Reply
Thread Tools

Re: extracting string

 
 
Zoran Cutura
Guest
Posts: n/a
 
      06-26-2003
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".
>
> I am confused about how to do it ?
>
> Please help! Thanks!


strstr() is your friend. It will find your needle in the haystack, the
returned pointer will point to the beginning of the needle, adding
strlen(small) to that pointer will yield a pointer to the position after
that substring.

--
Z ()
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting a string Mar Thomas Java 9 01-15-2004 04:54 AM
extracting integers from string R Java 2 07-25-2003 03:47 AM
Re: extracting string CBFalconer C Programming 0 06-26-2003 10:34 AM
Re: extracting string Ben Pfaff C Programming 0 06-26-2003 05:59 AM
Re: extracting string Martien Verbruggen C Programming 0 06-26-2003 05:58 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57