How do I print a tab character in Pascal?
Solution 1
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
Solution 2
write( ^i );
:-)
Related videos on Youtube
Gabriel
Data Analyst. Postgres, Oracle, Tableau. Having fun making scrapping tools and other stuff in Go and Javascript. Linux user for 15+ years, Archlinux FTW! Systems Engineering student at UTN.
Updated on May 06, 2022Comments
-
Gabriel almost 2 years
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.
-
Marco van de Voort over 6 yearsThat's the classic way, note that i is the 9th letter of the alphabet. So #1 is ^A etc