Trim does not trim CR/LF

Trim does not trim CR/LF

  
I've noticed that the TRIM() function does not trim CR/LFs from a string. There should be an option to specify additional characters to trim (like CR/LF). Does anyone have something that does this? TIA!
I've noticed the same thing, and it is frustrating because the Trim() behavior in other systems is ALL "whitespace" which includes newline.

What you can do:

1. Use Regex_Replace to search for ^\n and \n$ (I may have that reversed, I'm tired) and replace them with ""

2. If Index(NewLine()) = 0, get Substr(1, Length(Value) - 1), if Index(NewLine()) = Length(Value - 1), get Substr(0, Length(Value - 1))

You may want to roll them into an "EnhancedTrim" Action set to a "function" to make life easier. :)

J.Ja
Thanks
Justin James wrote:
I've noticed the same thing, and it is frustrating because the Trim() behavior in other systems is ALL "whitespace" which includes newline.

What you can do:

1. Use Regex_Replace to search for ^\n and \n$ (I may have that reversed, I'm tired) and replace them with ""

2. If Index(NewLine()) = 0, get Substr(1, Length(Value) - 1), if Index(NewLine()) = Length(Value - 1), get Substr(0, Length(Value - 1))

You may want to roll them into an "EnhancedTrim" Action set to a "function" to make life easier. :)

J.Ja
 
Thanks.

Actually, the code is something like this:
To strip at beginning:
If Index(TrimmedText,NewLine()) = 0 then TrimmedText = Substr(TrimmedText,2,Length(TrimmedText)-1)

To strip at end:
If Index(TrimmedText,NewLine(),Length(TrimmedText)-1,True) = Length(TrimmedText) -2 then TrimmedText = Substr(TrimmedText,0,Length(TrimmedText)-2)

Put each in a loop.

(Need to remember that NewLine() is CHR(13) + CHR(10) and that accounts for 2 characters.)