[fpc-pascal]ansistring and fillchar
Thomas Schatzl
tom_at_work at gmx.at
Wed Dec 10 09:33:20 CET 2003
Hello,
> How can I use fillchar to give an ansistring a value of, say
> 'xxxxxxxxx'? In other words, I want to create a string that contains
> only a single character, that is repeated a certain number of times.
E.g. this should work (with some typecasting ;-):
{$MODE DELPHI}
var
s : AnsiString;
begin
SetLength(s, 20);
fillchar(PChar(s)^, length(s), 'a');
WritelN(s);
end.
Regards,
Thomas
More information about the fpc-pascal
mailing list