Consultor Eletrônico



Kbase P81733: The statement RIGHT-TRIM('1-1','-1') returns blank string should return '1'
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/10/2004
Status: Unverified

SYMPTOM(s):

The statement RIGHT-TRIM("1-1","-1") returns blank string

It should return a value of "1"

CAUSE:

The RIGHT-TRIM function is documented to trim (starting from the right) a set of characters and not a string. This means that each character in the second parameter of the function will be removed separately from the string. Given the function RIGHT-TRIM("1-1","-1"), we first start at the right side of the string, find the first instance of the first trim character and remove each instance of that character that exists until we find a character that is not that character. This is then repeated for each character in the trim list.

Use the sample code shown in the documentation for the RIGHT-TRIM function to more clearly understand how the function works.

FIX:

Use the R-INDEX function to find the position of the string literal within the source string then use the SUBSTRING statement to remove the unwanted literal.