News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

string replace algo???

Started by daydreamer, May 28, 2018, 03:47:03 AM

Previous topic - Next topic

daydreamer

Hi
I feel I am stuck with option of brute force solution,I want to learn of string algos to see if I can find a faster,better algo
wouldnt the fastest be a search tree algo?
I have not enough experience in string algos
I have worked on few .inc files and one testdata file and reduced .inc files from 800bytes to around 180bytes
also needed is support a unicode version of "-",that is inserted in Words, to show long pronouncation of vokal
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

A normal string replace scans for the start character then branches to test if its a match or not, if it matches, the string replacement is written to the start character location to overwrite the string that has been found then continues with the first character scan. What complicate a replace algo is if the replacement is longer than the string it replaces, to solve this you first scan the string to see how many instances of the word to replace exist, do the arithmetic and allocate a big enough buffer to hold the result.

daydreamer

thanks Hutch
I start with simple replace algo
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding