eclipse 粘贴字符串自动添加转义符

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,自动转义。

[html] view plain copy
  1. String xml = <state name="state">  
  2.                 <paths>  
  3.                   <path to="1" expr="i==1"/>  
  4.                   <path to="2" expr="i==2"/>  
  5.                 </paths>  
  6.               </state>  


变成

String xml = 

[java] view plain copy
  1. String xml = "<state name=\"state\">\n" +   
  2.         "                <paths>\n" +   
  3.         "                  <path to=\"1\" expr=\"i==1\"/>\n" +   
  4.         "                  <path to=\"2\" expr=\"i==2\"/>\n" +   
  5.         "                </paths>\n" +   
  6.         "              </state>"

你可能感兴趣的:(eclipse)