find repeated sub-strings

new topic     » topic index » view thread      » older message » newer message

Hello all,

I need a function that finds the most repeated segments in a string.
For example:
If I had a string: "the quick brown fox jumped over the lasy brown dog"
our hypothetical function would find the repeated sub-strings:
" brown " and "the "
I would like this function to also keep track of how many times each
multiple match was matched; like so:
{{2," brown "}, {2, "the "}} -- prefered return format
Also, don't bother returning a string that is less than 2 characters
long. Am I making sense?
Does anyone have code that does this or something very similar?
As you might have guessed, it is for a compression algorithm I have
in mind but I am stumped at this first vital funtion.
I always run up against possible problems and try to redesign all
over again just to realize another possible flaw in my algorithm.

any help would be appreciated,

later,
Lewis Townsend
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu