Since you're solving a slightly different problem, your claim may be tautologically correct for now.

Charles Yeomans

On Sep 5, 2006, at 3:13 PM, Theodore H. Smith wrote:

I did test the Squeeze function with several strings and it was always
*much more* slower than the solution I posted (tested on a Win2K
machine with 2005r4).

This version, however, is the fastest of them all :) It doesn't work on UTF-16, but UTF-8 is fine.

Function Squeeze(e as ElfData, char as string) As ElfData
   #pragma disableAutoWaitCursor //SpeedUpPragmas
   #pragma disableBoundsChecking
   #pragma disableBackgroundTasks
   #pragma StackOverflowChecking false
   dim TwoChars as ElfData
   dim Found, CharNum, Last as Integer

   TwoChars = char + char
   Found = e.InStr( TwoChars )
   if Found = 0 then Return e

   CharNum = TwoChars.ByteVal
   dim fs as new FastString

   do until found = 0
      fs.AppendSectElfData e, Last + 1, Found - Last

      While e.ByteVal( Found + 1 ) = CharNum
         Found = Found + 1
      wend

      Last = Found

      Found = e.InStr( Last + 1, TwoChars )
   loop

   fs.AppendSectElfData e, Last + 1, ElfData.kEnd

   Return fs
End Function


I tested it works like this:

EditField1.text = Module1.Squeeze( EditField1.text, EditField2.text )

ElfData has an operator convert that lets it transparently convert to/from strings.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to