LTRIM examines a data string from left to right and compares the contents to an exclusion character string. If a match is found between the data string and the exclusion character string, the LTRIM function removes the characters which match the exclusion character string. LTRIM continues until the first non-matching character is found. It also provides flexibility regarding the method of comparison by specifying either the ANY or MATCH parameter. Note that for single character exclusion strings, ANY and MATCH will return the same results.
Category
String
LTRIM(data_string, exclusion_character_string, ''ANY' | 'MATCH')
Parameter | Description |
---|---|
data_string | The data string in character format. The data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
exclusion_character_string | One (1) or more characters that are to be removed from the left hand side of the data string. Exclusion characters may be a field of a source datastore, a literal value or the output of another Function. |
ANY | MATCH | Denotes the type matching from the left side of a source data string based on the contents of the exclusion character string.
Note: These parameters must be enclosed in single quotes.
|
Example
LTRIM with datastore field, literal, variable, output of another Function.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM('ABCD', 'A', 'MATCH')
TARGET.FIELD = LTRIM(VARIABLE, 'A', 'MATCH')
TARGET.FIELD = LTRIM(FUNCTION(SOURCE.FIELD), 'A', 'MATCH')
--Assuming SOURCE.FIELD = 'ABCD', VARIABLE = 'ABCD', and the result of
--FUNCTION(SOURCE.FIELD) = 'ABCD', the results would be 'BCD' for all cases
.
TARGET.FIELD = LTRIM('ABCD', SOURCE.FIELD, 'MATCH')
TARGET.FIELD = LTRIM('ABCD', 'A', 'MATCH')
TARGET.FIELD = LTRIM('ABCD', VARIABLE, 'MATCH')
TARGET.FIELD = LTRIM('ABCD', FUNCTION(SOURCE.FIELD), 'MATCH')
--Assuming SOURCE.FIELD = 'A', VARIABLE = 'A', and the result of
--FUNCTION(SOURCE.FIELD) = 'A' the results would be 'BCD' for all cases.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'ANY')
--Assuming SOURCE.FIELD = 'ABCD', the results would be 'BCD' for all cases.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'ANY')
--Assuming SOURCE.FIELD = 'AAABCD', the result would be 'BCD' for either case.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'AB', 'MATCH')
--Assuming SOURCE.FIELD = 'ABABCD', the result would be 'CD'.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'ABC', 'MATCH')
--Assuming SOURCE.FIELD = 'CABCDA', the result would be 'DA'.