On 9/17/13, Hans-Peter Diettrich <drdiettri...@aol.com> wrote: >> function Utf8StringOfChar(AUtf8Char: Utf8String; N: Integer): Utf8String; >> var >> UCharLen, i,nb: Integer; >> PC: PChar; >> begin >> Result := ''; >> UCharLen := Length(AUtf8Char); > nb := N*UCharLen; > if nb <= 0 then exit; >> //3: > Result := AUtf8Char; >> SetLength(Result, nb); > PC := Result; >> for i:=1 to nb-UCharLen do >> begin >> PC[UCharLen] := PC[0] inc(PC); >> end; >> end; >
I would think that FiilWord and FillDWord is faster than that. For 3-byte sequence I almost did the same as you. More to the point: does it produce correct results on BigEndian. Theory (as in: as far as I can see and "compute in my head") says yes, but I would like confirmation (on my secons code example). Bart -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus