Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
SPACE()
This is a function that has pretty much outlived its usefulness. It returns a string composed of a specified number of blanks (CHR(32)).
cMyString = SPACE( nLength )
Before EMPTY()
was added to FoxPro, to determine if a character field had any data in it, you’d compare it to SPACE(LEN(fieldname)). This was considered a forward-thinking solution since it would continue to work even if the field’s size was increased. But EMPTY()
performs the same test more quickly and is more readable.
The only use left for SPACE()
is for initializing variables to a certain size.
cLastName = SPACE(30) && sets variable cLastName to 30 spaces