Remove Line Feed from String Entry

Remove Line Feed from String Entry

I need to write on Add Success function to remove some text and line feeds from an input field. For example

Line 1
other text

Line 2

I would like to convert this to

Line 1
Line 2