Share via


ALLTRIM( ) Function

Removes all leading and trailing spaces or parsing characters from the specified character expression, or all leading and trailing zero (0) bytes from the specified binary expression.

ALLTRIM(Expression [, nFlags] [, cParseChar [, cParseChar2 [, ...]]])

Parameters

  • Expression
    Specifies an expression of Character or Varbinary type to remove leading and trailing spaces or 0 bytes from, respectively.

  • nFlags
    Specifies if trimming is case-sensitive when one or more parse characters (cParseChar, cParseChar2, … are included. Trimming is case-sensitive if nFlags is zero or is omitted. Trimming is case-insensitive if nFlags 1.

  • cParseChar [, cParseChar2 [, ...]]
    Specifies one or more character strings that are trimmed from the beginning and end of cExpression. If cParseChar is not included, then leading and trailing spaces or 0 bytes are removed from Expression.

    Note   The maximum number of strings permitted in cParseChar is 23.

Return Value

Character or Varbinary. ALLTRIM( ) returns the specified expression without leading or trailing spaces, parsing characters, or 0 bytes respectively.

Remarks

You can use ALLTRIM( ) to ensure that spaces or 0 bytes are removed from data entered by a user.

Example

The following example uses the AFONT( ) function to create an array containing the names of all available fonts. ALLTRIM( ) removes the leading and trailing spaces from the font names. The trimmed name of each font is displayed along with an example of the font. If more than 10 fonts are installed, only the first 10 are displayed.

CLEAR
=AFONT(gaFontArray)  && Array containing font names
gnNumFonts= ALEN(gaFontArray)  && Number of fonts
IF gnNumFonts > 10
   gnNumFonts = 10  && Display first 10 fonts
ENDIF

FOR nCount = 1 TO gnNumFonts
   ? ALLTRIM(gaFontArray(nCount))  && Display font name
   ?? '  This is an example of ' ;
      + ALLTRIM(gaFontArray(nCount)) FONT gaFontArray(nCount), 8
ENDFOR

See Also

Reference

LTRIM( ) Function

RTRIM( ) Function

TRIM( ) Function

AFONT( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)