Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I print a tab character in Pascal?

I'm trying to figure out in all the Internets what's the special character for printing a simple tab in Pascal. I have to format a table in a CLI program and that would be handy.

like image 337
Gabriel Avatar asked Oct 21 '10 04:10

Gabriel


1 Answers

Single non printable characters can be constructed using their ascii code prefixed with #

Since the ascii value for tab is 9, a tab is then #9. Characters such constructed must be outside literals, but don't need + to concatenate:

E.g.

 const
     sometext  = 'firstfield'#9'secondfield'#13#10;

contains two fields separated by a tab, ended by a carriage return (#13) + a linefeed #10

The ' character can be made both via this route, or shorter by just ending the literal and reopening it:

 const 
    some2 = '''bla''';           // will contain 'bla' with the ticks.
    some3 = 'start''bla''end';   // will contain start'bla'end
like image 120
Marco van de Voort Avatar answered Sep 22 '22 19:09

Marco van de Voort