When you paste some text in to a string have you seen this?

The problem is that the string is not escaped. This gives you a error. Fixing this is not easy if you have pasted text that needs a lot of escaping. I have encountered this a few times. It is annoying.

Luckily Eclipse has a simple solution for this. Go to Window>Preference>Java>Editor>Typing and check the “Escape text when pasting into a string literal“. Now when you paste the same text here is what you get:

Nice. What would make this feature more discoverable would be when pasting the string an icon should pop up like in Microsoft Word and provide you an option to paste the escaped string…

Very useful. Thanks for sharing!
@ Peter Štibraný
You are welcome.
Hello Vasanth,
Thanks for the tip. Its very useful.
You are welcome