Whenever you lot glue String inwards Eclipse which contains escape characters, to shop inwards a String variable or simply equally String literal it volition enquire to manually escape special characters similar unmarried quotes, double quotes, frontward slash etc. This occupation is to a greater extent than prominent when you lot are pasting large chunk of information which contains escape characters similar a whole HTML or XML file, which contains lots of unmarried quotes e.g. ‘’ as well as double quotes “” along alongside frontward slash on closing tags. It’s real difficult to manually escape all those characters as well as its pretty annoying equally well. While writing JUnit test for XML documents, parsing as well as processing I prefer to bring whole XML file equally String inwards Unit test, which pointed me to await for that characteristic inwards Eclipse. As I said before inwards my post service Top xxx Eclipse keyboard shortcuts, I ever await to honour novel shortcut as well as settings inwards Eclipse which assist to automate repetitive task. Thankfully Eclipse has ane setting which automatically escapes text equally shortly equally you lot glue it. This is fifty-fifty to a greater extent than useful if you lot prefer to re-create file path as well as simply glue it, Since windows uses frontward slash it automatically escape that instead of you lot going manually as well as escaping them. By default this setting is disabled inwards Eclipse IDE as well as you lot demand to enable it.
How to enable automatic escaping spell pasting text equally String literal inwards Eclipse :
Here is the steps you lot demand to perform to enable this setting inwards Eclipse which volition automatically render escaping required inwards Java for especial characters similar quotes, slashes etc.
1. Open Eclipse IDE
2. Go to Windows --> Preferences --> Java --> Editor --> Typing
3) cheque the cheque box "Escape text when pasting into a String literal" on department "In String literals.
This volition escape text when pasted equally String literal. Do it now, its an selection worth enabling as well as I simply wonder why non Eclipse IDE brand this selection enable past times default. Believe me its extremely useful but same fourth dimension difficult to discover. Here is a covert shot of this option. As you lot tin see, past times default this selection is non enabled.
Next fourth dimension no demand to extra edit whatever XML or HTML text before pasting equally String literal inwards Eclipse IDE. Eclipse volition create it for you lot automatically. Once again, if you lot are doing anything manually as well as mean value that it would hold upwardly adept Eclipse tin assist on that task, await for it using google or Eclipse help. There is adept jeopardy you lot tin uncovering a useful Eclipse shortcut or settings.
Further Learning
Beginners Eclipse Java IDE Training Course
Eclipse Debugging Techniques And Tricks
How to remote debug Java programme inwards Eclipse