Re: extracting string
On 25 Jun 2003 22:46:47 -0700,
qazmlp <email@example.com> wrote:
> const char* big = "abcdefgh123" ;
> const char* small = "bcd" ;
> Now, I want to extract the remaining string from big, after the small
> 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 Verbruggen | Freudian slip: when you say one thing but
Trading Post Australia | mean your mother.
|All times are GMT. The time now is 03:41 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.