How to: |
The TRIMV function removes leading and/or trailing occurrences of a pattern within a character string. TRIMV is similar to TRIM. However, TRIMV allows the source string and the pattern to be removed to have AnV format.
TRIMV is useful for converting an An field to an AnV field (with the length in bytes containing the actual length of the data up to the last non-blank character).
TRIMV(trim_where, source_string, upper_limit, pattern, pattern_limit, output)
where:
Alphanumeric
Is one of the following, which indicates where to remove the pattern:
'L' removes leading occurrences.
'T' removes trailing occurrences.
'B' removes both leading and trailing occurrences.
Alphanumeric of type An or AnV
Is the source string to be trimmed. If it is a field of type AnV, its length is taken from the length in bytes stored in the field. If upper_limit is smaller than the actual length, the source string is truncated to this upper limit.
Integer
Is limit for the length of the source string.
Alphanumeric of type An or AnV
Is the pattern to remove. If it is a field of type AnV, its length is taken from the length in bytes stored in the field. If pattern_limit is smaller than the actual length, the pattern is truncated to this limit.
Integer
Is the limit for the length of the pattern.
Alphanumeric of type An or AnV
If the output format is AnV, the length is set to the number of characters left after trimming.
TRIMV removes trailing blanks from TITLE and stores the result in a column with the format A39V:
TRIMV('T', TITLE, 39, ' ', 1, 'A39V')
iWay Software |