C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-25-2002, 08:36 PM   #1
SPEKTRUM
Guest
 
Posts: n/a
Question string manipulation

Hi, any help on this would be appreciated.

I need to insert a string some where inside of another string. Example:

My String.

My goofy String.

I need to insert 'goofy' inside of 'My String'. see what I mean?

Thanks.
  Reply With Quote
Old 01-25-2002, 10:11 PM   #2
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
Hi Spektrum,

memmove() comes to mind.

Cheers,
__________________
Jason Deckard
Deckard is offline   Reply With Quote
Old 01-25-2002, 10:38 PM   #3
SPEKTRUM
Guest
 
Posts: n/a
thanks!
  Reply With Quote
Old 01-26-2002, 11:41 AM   #4
junior member
 
mix0matt's Avatar
 
Join Date: Aug 2001
Posts: 144
if you're using C++, you can use the string Datatype. it provides an insert method....

Code:
#include <iostream>

using std::cout;
using std::endl;

#include <string>

using std::string;

int main ()
{
    string s1 = "My String";

    s1.insert (3, "Goofy ");             // insert "Goofy " at position 3
    cout << s1 << endl;
     return 0;
}
__________________
THIS IS NOT JUST A CHRONICLING OF THINGS WE HAVE DONE IN THE PAST BUT OUR RISE TO POWER.
mix0matt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ ini file reader problems guitarist809 C++ Programming 7 09-04-2008 06:02 AM
RicBot John_ C++ Programming 8 06-13-2006 06:52 PM
Compile Error that i dont understand bobthebullet990 C++ Programming 5 05-05-2006 09:19 AM
String editor for a sentence inputted by a user - any suggestions or ideas? the_newbug C Programming 4 03-03-2006 02:11 AM
Linked List Help CJ7Mudrover C Programming 9 03-10-2004 10:33 PM


All times are GMT -6. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22