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)).

Usage

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.

Example

cLastName = SPACE(30)  && sets variable cLastName to 30 spaces

See Also

Empty(), Len(), Replicate()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .