I assume C++. string::substr(x,y) returns a string which is a copy of the
defined substring. x is the starting position and y the length e.g.
string s="Hello World";
string test=s.substr(6,5);
//Here test is "World".
s.replace(6, 5, "Nightmare"); // s is "Hello Nightmare"
Ioannis
* Ioannis Vranos
* Programming pages: http://members.nbci.com/noicys
* Alternative URL: http://run.to/noicys
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Brian Becker
Sent: Sunday, March 18, 2001 10:33 PM
To: Dev...@li...
Subject: [Dev-C++] Getting only parts of strings
Hi,
I have had a terrible time trying to just copy part of a string into
another string. I wanted to be able to pass a start and an end and a string
to a function and have it return the part of the string between the two
numbers without using anything but api, sort of like the BASIC mid function.
I have tried lstrcpyn, and CharNext, and even incrementing pointers and
assigning them to each other with no success. I was wondering if anybody
could help me. Thanks.
Brian
----------------------------------------------------------------------------
--
Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo!
Mail.
|