Hi all. Is there a command in C that can delete a string contained in a longer string and then replace the deleted string with another? Big thanks to those who can help me with this.
shinsengumi
-10
Junior Poster in Training
Recommended Answers
Jump to PostNo command. You have the write the code to do that yourself. Write down on a piece of paper the original string. Then using your pencil try to delete and insert the new text. Doing that visually may help you to understand more clearly how it might be done with …
Jump to Postpseudo code
do { does search string exist in long string? No -- then exit the loop replace search string with replacement string } // end of loop
Jump to PostYou should first try to write a string matching algorithm .
If the longer strings contains the smaller string in many places, can you successfully print the locations of the sub string in the main string ?
Jump to PostYou know what has to be done, so now all you have to do is stop asking the same question over and over and get to coding it. Its a very simple loop as previously illustrated.
Jump to Post1. creating a loop that continuously searches all occurrences of the substring until the end of the longer string
2. replace the substring with another stringYes, this pretty much defines the whole problem. Have you tried anything yet? I still don't see any posted attempts by you, either in …
All 20 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shinsengumi
-10
Junior Poster in Training
shinsengumi
-10
Junior Poster in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
abhimanipal
91
Master Poster
shinsengumi
-10
Junior Poster in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shinsengumi
-10
Junior Poster in Training
Ezzaral
commented:
Great way to show your appreciation to those who take the time to help you.
-3
Adak
419
Nearly a Posting Virtuoso
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shinsengumi
-10
Junior Poster in Training
Narue
commented:
Very mature...
-5
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
shinsengumi
-10
Junior Poster in Training
WolfPack
commented:
You don't deserve to be a programmer. Find another job.
-2
Narue
5,707
Bad Cop
Team Colleague
shinsengumi
-10
Junior Poster in Training
shinsengumi
-10
Junior Poster in Training
Narue
5,707
Bad Cop
Team Colleague
shinsengumi
-10
Junior Poster in Training
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Adak
419
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.