Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
Visual Basic and Visual FoxPro functions create repeating characters
VBASpace(), String() |
VFPSpace(), Replicate(), PadL(), PadR(), PadC() |
Visual Basic Syntax Notes
The Space() function generates a string of spaces. The String() function will generate a string of repeating characters. This example will produce 12 asterisks:
Visual Foxpro Syntax Notes
The Space() function has the same syntax as in Visual Basic and generates a string of spaces. The Replicate() function will generate a string of repeating characters. This example will produce a string of 10 dashes:
Visual FoxPro also has functions that will pad a string to a given length. The PadL(), PadR() and PadC() will add spaces or characters to an existing string and leave it left, right, or centre-aligned within a longer string. For example:
will pad "Test" out to 12 characters long with equal numbers of dashes on either side: "----Test----". This command used to be very useful for making pretty headers on plain typed reports.
Warning
The String() and Replicate() functions both take a character and a number as their parameters but the orders are reversed in FoxPro and Basic.