implicit QChar constructors

Roger Larsson kde-optimize@mail.kde.org
Thu, 23 Jan 2003 08:54:40 +0100


More stones... :-)

On Thursday 23 January 2003 08:38, Christopher Eineke wrote:
> Oswald Buddenhagen wrote:
> //sledge's modified code
> QString QstringList::join(const QString &seperator) const
> {
> =09QString result;
> =09QStringList::ConstIterator it;
> =09uint total_length;
> =09bool already;
> =09
> =09//Sum up string lengths
> =09for (it =3D begin(); it !=3D end(); ++it ) {
> =09=09total_length +=3D it->length();
> =09}

You forgot the separator length...

//Sum up string lengths
for (it =3D begin(); it !=3D end(); ++it ) {
=09total_length +=3D it->length() + sep.length();
}
total_length -=3D sep.lenght();

And you also forgot the initialization of 'already'...

/RogerL