Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-12

AW: ansistring and fillchar

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ZINTEL Gerhard

Hello Mark

Show quoted text 7 lines
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