Name
Spc Function
Class
Microsoft.VisualBasic.FileSystem
Syntax
Spc(n)-
n Use: Required
Data Type: Integer
The number of spaces required
Return Value
A String containing n spaces
Description
Inserts spaces between expressions in a Print or
PrintLine procedure
Rules at a Glance
Spccan only be used with thePrintorPrintLineprocedure.If the width of the device being printed to is greater than
n, the print position is set to immediately after the number of spaces printed by theSpcfunction.If the width of the device being printed to is less than
n, the print position is set to the current position plus the result of the formulanModdevicewidth.If
nis greater than the difference between the current print position and the width of the device,Spcinserts a line break and then inserts spaces in accordance with the following formula:n - (devicewidth - currentposition)
When using a proportional font, the
Spcfunction uses the average width of all characters for that particular font to determine the width of the space character to print.
Programming Tips and Gotchas
When the number of fixed-width columns is important, you should use either the
Spaceor theTabfunction, since there is not necessarily a relationship between the spaces provided by theSpcfunction and fixed-width columns.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access