`
m635674608
  • 浏览: 4929634 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

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

    博客分类:
  • java
 
阅读更多

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

  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 = 

  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>"
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics