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 [, ...]]])



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


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.

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

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

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.

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

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

Community Additions