Subject Re: [firebird-support] Re: udf firebird delphi
Author Marc Collin
Martijn Tonies wrote:

> Try this one:
>
> procedure MixString(Incoming: PChar);
> var OutStr, IncomingStr: string;
> i, j: Integer;
> begin
> IncomingStr := StrPas(Incoming);
> OutStr := '';
> while Length(IncomingStr) > 0
> do begin
> i := Random(Length(IncomingStr) - 1) + 1;
> // we select a random position in an ever becoming smaller string
> OutStr := OutStr + IncomingStr[i];
> // and copy the character at the selected position to our output string
> // without overwriting other characters
> Delete(IncomingStr, i, 1);
> end;
> StrPCopy(Incoming, OutStr);
> end
>
>
>
> It might not be particular fast on largish strings though...

i used that before... but the other is faster... don't know why that
work under delphi and not udf...


> With regards,
>
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
> Server.
> Upscene Productions
> http://www.upscene.com