eclipse 貼上字串自動新增轉義符
阿新 • • 發佈:2019-01-03
Eclipse has an option so that copy-paste of multi-line text into String literals will result in quoted newlines:
Preferences/Java/Editor/Typing/ "Escape text when pasting into a string literal"
新增一個字串到eclipse裡面,自動加上轉義
比如給一個String 賦值 一段xml,自動轉義。
- String xml = <statename="state">
- <
- <pathto="1"expr="i==1"/>
- <pathto="2"expr="i==2"/>
- </paths>
- </state>
變成
String xml =
- String xml = "<state name=\"state\">\n" +
- " <paths>\n" +
- " <path to=\"1\" expr=\"i==1\"/>\n"
- " <path to=\"2\" expr=\"i==2\"/>\n" +
- " </paths>\n" +
- " </state>";