I was looking for the find and replace algorithm which editor softwares are using. for ex: notepad. when i search something and then when i replace it , how exactly it works. I am aware of rabin-karp and KMP algos. but i am wondering if they are most efficient ? and how do they replace it ? Seraching is okay, may be KMP can be applied, but replacing has some cases like when replaced words is of greater length and when it is of smaller length. Can you explain or give some link to it ? how will you shift whole text after that word in efficient way. thanks.
nitin1
15
Master Poster
Recommended Answers
Jump to PostI would use a temporary char array -- after you find the beginning of the string to be replaced copy the first part of the original string into the temp array, copy the replacement string into the temp buffer, then finally copy the remainder of the original string
Maybe a …
Jump to PostI did some tinkering with the example of Range.Find in MSDN and got this to work. "Knee" was used a lot in the file I was working.
Private Sub FindAndReplace() Dim C As Range Dim FirstAddress As String With Worksheets(1).Range("a1:G40") Set C = .Find("Knee", LookIn:=xlValues) If …
Jump to PostThat is VB.NET not C. Wrong forum.
All 10 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Klahr_R
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Klahr_R
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
nitin1
15
Master Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Adak
419
Nearly a Posting Virtuoso
Adak
419
Nearly a Posting Virtuoso
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
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.