On Jun 9, 2006, at 11:25 AM, Theodore H. Smith wrote:



Hi Mark,

use ElfData! MSR especially.

dim msr as new msr

msr.Add "and", nil
msr.Add "in", nil
msr.Add "the", nil
msr.Add "of", nil
msr.Add "to", nil
// etc etc etc

theString = msr.ReplaceAll(theString)

All done!!

one thing though, the above example is bad code, because we are creating a new msr object everytime we do the replacement. It's better to create an msr and cache it for next time, like this:


dim module_msr_common as msr
function RemoveCommonWords() as MSR
  if module_msr_common = nil then
    module_msr_common = new msr
    module_msr_common.add "and", nil
    /// etc etc
  end if
  return module_msr_common
end function

This way, you make it all nice and fast :)

But possibly not what was wanted, as Didier pointed out. RegEx is the right tool for this.

Charles Yeomans
_______________________________________________
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