The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-21-2008
cleopard cleopard is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 29
substituting one string for another

I have a Linux C program I'm writing that has one section where, within a large string, I need to substitute a smaller string for another, and those probably won't be the same size.

For instance, if I have a string:

"Nowisthetimeforallgoodmen"

and I want to substitute 'most' for 'all' the main string will increase in size:

"Nowisthetimeformostgoodmen"


or a substitution that will increase the size of the main string:

"Nowisthetimefornogoodmen"


I thought I might get some opinions about what might be the best approach on something like this, besides some more cumbersome way of doing it. I've been looking at the C string functions to see if there's one that might be helpful, but I don't really see any.

Any help would be appreciated.