3.2.48. SPACE(string[,[length][,padchar]])

With only one parameter string is returned, stripped of any
trailing or leading blanks, and any consecutive blanks inside
string translated to a single <space> character (or padchar if
specified).

Length must be a non-negative whole number. If specified,
consecutive blanks within string is replaced by exactly length
instances of <space> (or padchar if specified).  However, padchar
will only be used in the output string, in the input string,
blanks will still be the “magic” characters. As a consequence, if
there exist any padchars in string, they will remain untouched and
will not affect the spacing.

     SPACE(‘ Foo  bar ‘)      –>   ‘Foo bar’
     SPACE(‘ Foo  bar ‘, 2)        –>   ‘Foo  bar’
     SPACE(‘ Foo  bar ‘,, ‘*’)     –>   ‘Foo*bar’
     SPACE(‘Foo bar’, 3, ‘-‘) –>   ‘Foo—-bar’
     SPACE(‘Foo  bar’,, ‘o’)       –>   ‘Fooobar’



PREV NEXT