SPACE()

Returns a string of blank spaces

Syntax

SPACE( <nSize> ) --> cString

Arguments

<nSize> The lenght of the string

Returns

<cString> A string containing blank spaces

Description

This function returns a string consisting of <nSize> blank spaces. If the value of <nSize> is 0, a NULL string ( "" ) will be returned.

This function is useful to declare the lenght of a character memory variable.
Examples
      FUNC MAIN
      LOCAL cBigString
      LOCAL cFirst
      LOCAL cString := Space(20)   // Create an characte memory variable
                                   // with lenght 20
      ? len(cString)      // 20
      cBigString:=space(100000)    // create a memory variable with 100000
                                   // blank spaces
      ?  len(cBigString)
      Use Tests New
      cFirst:= makeempty(1)
      ? len(cFirst)
      Return Nil

      Function MakeEmpty(xField)
      LOCAL nRecord
      LOCAL xRetValue

      If !empty(alias())
          nRecord:=recno()
          dbgoto(0)
          if valtype(xField)=="C"
              xField:= ascan(dbstruct(),{|aFields| aFields[1]==upper(xfield)})
          else
              default xField to 0
              if xField < 1 .or. xField>fcount()
                  xfield:=0
              endif
          endif
          if !(xfield ==0)
              xRetvalue:=fieldget(xfield)
          endif
          dbgoto(nrecord)
      endif
      return( xRetvalue)
Tests
      See examples
Status

Ready

Compliance

This function is Ca-Clipper compliant in all aspects, with the exception don't have the Clipper 64Kb string length.

Platforms

All

Files

Library is rtl

See Also