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

List:       koffice
Subject:    Re: removing commas from a cell in kspread
From:       Nicolas Goutte <nicog () snafu ! de>
Date:       2002-06-20 19:53:57
[Download RAW message or body]

Perhaps, you could start with a KSpread function similar to 
QString::replace(const QRegExp&, const QString&)

It would be perhaps not as flexible as the 's' command of sed, but it could 
work in many simple cases and it would be easier to implement.

Have a nice day/evening/night!

On Thursday 20 June 2002 13:24, Bo Thorsen wrote:
> On Thursday 20 June 2002 13:14, Thomas Zander wrote:
> > Simply doing this in the QRegexp  from the start seems a better solution
> > to me...
> >
> > A simple QString.replace(new QRegExp(","), ""); should do the trick :)
>
> The point of using sed instead of this was to make it general instead of
> just this single solution.
>
> > On Thu, Jun 20, 2002 at 12:56:20PM +0200, Nicolas Goutte wrote:
> > > Be careful! Sed can read and especially write from/to any arbitrary
> > > file. It could be a security risk! (Trojan Horses)
> > >
> > > Possible solutions:
> > > - check the command given to sed and forbid 'r' and 'w'
> > > - only allow certain commands (like 's')
> > > - implement only 's' as KSpread function (instead of sed, this could be
> > > perhaps coded around QRegExp.)
> > >
> > > Have a nice day/evening/night!
> > >
> > > On Wednesday 19 June 2002 21:10, John Dailey wrote:
> > > > I think the SED function sounds like the best idea -- although then
> > > > sed becomes a dependancy of the system.  I don't know if that's a bad
> > > > thing or now.
> > > >
> > > > Anyway, if you check the return value from the system call you should
> > > > be ok in implementing it.
> > > >
> > > > -John
> > > >
> > > > On Tuesday 18 June 2002 03:22 am, Bo Thorsen wrote:
> > > > > On Monday 17 June 2002 00:25, John Dailey wrote:
> > > > > > On Saturday 15 June 2002 06:22 am, Rob Benton wrote:
> > > > > > > I've got a cell in kspread that contains numeric data 13 digits
> > > > > > > long. But I don't want commas in it.  Is there a way to format
> > > > > > > it so that it reads like this:
> > > > > > > 3233112984432
> > > > > > > instead of this:
> > > > > > > 3,233,112,984,432
> > > > > >
> > > > > > No, there is not a way to do it -- but this looks like a good
> > > > > > idea. Please use bugs.kde.org to add a wishlist request for it. 
> > > > > > I believe this would take very little time to add so it almost
> > > > > > certainly could be done for the KOffice 1.2 release.
> > > > >
> > > > > Actually this made me think that it would be interesting to have
> > > > > pipes to sed in cells. Something like this:
> > > > >
> > > > > =D13+D14 | sed "s/,//"
> > > > >
> > > > > would solve this problem in a completely generic way instead of
> > > > > adding any number of adhoc solutions to parts of this problem.
> > > > >
> > > > > If you don't want to use the shell like approach to this (which
> > > > > would make the parser more, well, interesting) this would also be
> > > > > fine:
> > > > >
> > > > > =SED(D13+D14, "s/,//")
> > > > >
> > > > > If this sounds interesting, I might take a stab at implementing it
> > > > > myself. What do you think?
> > > > >
> > > > > Bo.


____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
http://mail.kde.org/mailman/listinfo/koffice
[prev in list] [next in list] [prev in thread] [next in thread] 

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