Remove line breaks or return codes from string

I have imported string data, which appears to have line breaks or return codes in it invisible in a notebook input cell.

Copying a string and pasting into Apple Pages with control codes showing gets me this:

I’ve looked at StringDelete, but can’t see a way to make it work for control characters.

How can I remove them?

=================

=================

1 Answer
1

=================

To remove line breaks from a string with StringDelete, you can simply do this:

string =
“I have imported string data, which appears to have line breaks or return codes in it invisible in a notebook input cell.

Copying a string and pasting into Apple Pages with control codes showing gets me this:”;

StringDelete[string, “\n” | “\r”]

(*
==> “I have imported string data, which appears to have line breaks or return codes in it invisible in a notebook input cell.Copying a string and pasting into Apple Pages with control codes showing gets me this:”
*)

  

 

I knew if had to have a simple solution. Thx.
– Jagra
Jun 27 ’15 at 5:44