I am looking for the fastest way to remove some characters from a WPRichText document so that it can be saved into an XML file. Basically, this is a sluggish way to achieve this.
while WP.Find('&', False) do WP.SelectionAsString := '@amp;';
while WP.Find('@amp;', False) do WP.SelectionAsString := '&';
while WP.Find('"', False) do WP.SelectionAsString := '"';
while WP.Find('''', False) do WP.SelectionAsString := ''';
while WP.Find('>', False) do WP.SelectionAsString := '>';
while WP.Find('<', False) do WP.SelectionAsString := '<';
But it would be much more efficient to scan the whole document and replace characters ['&','''','"','>','<'] with their corresponding string.
What would be the quickest way to do those replacements?