|
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.
|