[fpc-pascal] splitting string into array

Marc Santhoff M.Santhoff at t-online.de
Thu Jul 12 19:02:49 CEST 2007


Am Mittwoch, den 11.07.2007, 20:48 -0700 schrieb L: 
> > > > Wouldn't this function be a candidate for crawling into the 'strutils'
> > > > unit?
> > >
> > > Probably, but I would change the interface:
> > >
> > > function Split(const str: string; const separator: string; var Res : array
> of
> > > string) : Integer;
> > >
> > > So the function returns the number of elements in the array.
> > > The function could also use some speedup. Deleting the parts
> > > which are no longer needed causes a lot of memory fragmentation.
> 
> > I'd second your opinion about the interface, but regarding speedup and
> > memory fragmentation makes me think.
> >
> > For speed I'd need some hints, what technique would be faster/fastest?
> 
> [HUMOR ON]

[...]

> [HUMOR OFF]

Are you talking to me?

The question was not about algorithms but compiler internals.

Marc





More information about the fpc-pascal mailing list