[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: PATCH: kspread html export
From:       Nicolas Goutte <nicog () snafu ! de>
Date:       2001-07-30 0:13:32
[Download RAW message or body]

On Sunday, 29. July 2001 23:33, Carsten Pfeiffer wrote:
> On Sun, Jul 29, 2001 at 10:32:18PM +0200, Nicolas Goutte wrote:
> > Just as a note, you could also write it:
> >
> >   text.replace(QRegExp("&"), "&amp;")
> >        .replace(QRegExp("<"), "&lt;")
> >        .replace(QRegExp(">"), "&gt;");
>
> I can imagine this being pretty slow. Why use a regular expression,
> if all you want to do is replacing one character with some others?
> Especially doing this three times. Better iterate over all characters
> of `text' and replace all the &,<,> manually.

The first time I needed such a code for KWord's AbiWord export filter, I took 
it from KWord's ASCII import filter if I recall well. I have never thought 
about its cost.

But such code do exist in many of KWord's filters:
- ASCII (Import)
- AbiWord (Export)
- Applixword (Import)
- DocBook (Export)
- HTML (Export)
- RTF (Export)

So if there is anybody volunteers to create such a function, it would be very 
usefull. The maximum are 5 expressions (for AbiWord: &amp; &lt; &gt; &quot; 
&apos; )

The Latex export filter seems to use QString::replace too (in textzone.cc) 
but the use seems to be more complicate than for the filters listed above.

>
> Cheers
> Carsten Pfeiffer

Have a nice day/evening/night!
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic