title: Replace newline only at the end of string
body: <p>I need something like <code>TRIM</code> function to remove new line character in left or right of string.</p>
  
  <p>I can not use the below code:</p>
  
  <pre><code>DECLARE @str nVarchar(MAX) = 'Hello' + CHAR(10) + 'World' + CHAR(10)
  SET @str = REPLACE(REPLACE(@Str, CHAR(10), ''), CHAR(13), '')
  </code></pre>
  
  <p>because I have new line in middle of the variable. I need to remove only the new line character in position of start or end.</p>
  
  <p>I was expected the <code>TRIM</code> function do this but I failed.
  Do you know any other function?</p>