Trim()
Category: Text
Syntax: trim ( text ) |
Parameters:
textAny expression that resolves to a text string.
Data type returned: Text
Description:
Returns the specified text string with any leading or trailing spaces removed.
The TRim() function removes only leading and trailing spaces and not any other characters (such as carriage returns).
trim() can be used to reformat data where users have inadvertently typed spaces at the end of an entry. This happens frequently with fields containing first names. To automatically have the entry reformatted when the user exits the field, have the field auto-enter trim (FirstName) and uncheck the option not to replace any existing value in the field. Thus, if a user enters "Fred" into the FirstName field, it is replaced with "Fred" when the user exits the field.
TRim() is also used frequently to clean up fixed-width data that has been imported from some other data source. In such cases, fields have been padded with leading or trailing spaces to be a certain length. Remove them after importing by doing calculated replaces in the appropriate fields.
Examples:
Function | Results |
---|---|
trim (" This is a test ") | Returns This is a test. |
Категории