RE: [Dev-C++] Getting only parts of strings
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-03-19 00:21:03
|
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. |