Removing an Empty Line

I am wondering how to remove an empty line at the end of the string. For example, if the string is:

"Hello World
It is nice out


I would like to remove that third line. Is there a way to use replace to do this? Happy Thanksgiving and thanks for any help!

How about trimming the end of the string?