We have test like below
" Need modification.
Remove last line
"
In this example, we just need to remove next line char after remove last line string. We still need to keep next line after Need modification.
We are generating some documents and formatting should not change if users has entered next line in between the lines but only last line should be removed as soon as Users entered Save.
trim will not work here as it will remove from all the text
Discussion posts and replies are publicly visible
Split the string by line breaks, then reassemble the string ignoring empty items.
a!localVariables( local!input: " Need modification. Remove last line ", joinarray(split(local!input, char(10)), char(10)) )