AW: [fpc-pascal]ansistring and fillchar

ZINTEL Gerhard gzintel at stadeln.faurecia.com
Wed Dec 10 08:42:56 CET 2003


Hello Mark 

> 
> 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.
> 
> Mark
> 

There is an example in the reference guide for function FillChar. Not
exactly for ansistring. Try the following:

var s : ansistring;
begin
  setlength(s,100);
  FillChar(s[1],100,'x');
  writeln(s);
end;

Hope that helps
Gerhard




More information about the fpc-pascal mailing list