java 转义_java 转义符 \\|

this.p={ m:2,

b:2,

loftPermalink:'',

id:'fks_087065082082083070080094085068072087083067087085080069083084',

blogTitle:'java 转义符 \\\\|',

blogAbstract:'

看一段程序

String t =\"a||b||c||d\";\n\n

String[] temp = t.split(\"\\\\|\\\\|\");\n\n

System.out.println(temp.',

blogTag:'java,转义符',

blogUrl:'blog/static/12033667220133174828149',

isPublished:1,

istop:false,

type:0,

modifyTime:1364824178007,

publishTime:1364824177906,

permalink:'blog/static/12033667220133174828149',

commentCount:1,

mainCommentCount:1,

recommendCount:0,

bsrk:-100,

publisherId:0,

recomBlogHome:false,

currentRecomBlog:false,

attachmentsFileIds:[],

vote:{},

groupInfo:{},

friendstatus:'none',

followstatus:'unFollow',

pubSucc:'',

visitorProvince:'',

visitorCity:'',

visitorNewUser:false,

postAddInfo:{},

mset:'000',

mcon:'',

srk:-100,

remindgoodnightblog:false,

isBlackVisitor:false,

isShowYodaoAd:true,

hostIntro:'天天开心,广交天下朋友。',

hmcon:'1',

selfRecomBlogCount:'0',

lofter_single:''

}

{list a as x}

{if !!x}

{if x.visitorName==visitor.userName}

%24%7Bfn1(x.visitorName)%7D&r=%24%7Bvisitor.imageUpdateTime%7D

{else}

%24%7Bfn1(x.visitorName)%7D

{/if}

{if x.moveFrom=='wap'}

{elseif x.moveFrom=='iphone'}

{elseif x.moveFrom=='android'}

{elseif x.moveFrom=='mobile'}

{/if}

${fn(x.visitorNickname,8)|escape}

{/if}

{/list}

{if !!a}

%24%7Bfn1(a.userName)%7D

${fn(a.nickname,8)|escape}

${a.selfIntro|escape}{if great260}${suplement}{/if}

{/if}

{list a as x}

{if !!x}

推荐过这篇日志的人:

{list a as x}

{if !!x}

{if !!b&&b.length>0}

他们还推荐了:

{list b as y}

{if !!y}

{/if}

{list a as x}

{if !!x}

{list a as x}

{if !!x}

{list a as x}

{if !!x}

{list a as x}

{if x_index>4}{break}{/if}

{if !!x}

${fn1(x.title,60)|escape}${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}

{/if}

{/list}

{list a as x}

{if !!x}

{if !!(blogDetail.preBlogPermalink)}

网易新闻

%24%7Bimgsize(headlines.imgsrc,240,150,true)%7D

${headlines.title|escape}

{if defined('newslist')&&newslist.length>0}

{list newslist as x}

{if x_index>7}{break}{/if}

被推荐日志

最新日志

该作者的其他文章

博主推荐

随机阅读

首页推荐

{list a as x}

{if !!x}

${x.nickName|escape}  投票给

{var first_option = true;}

{list x.voteDetailList as voteToOption}

{if voteToOption==1}

{if first_option==false},{/if}  “${b[voteToOption_index]}”

{/if}

{/list}

{if (x.role!="-1") },“我是${c[x.role]}”  {/if}

${fn1(x.voteTime)}

{if x.userName==''}{/if}

{/if}

{/list}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果你使用Java生成XML文档,遇到了特殊字符需要进行转义,可以使用Java中的转义字符来实现。下面是一些常见的特殊字符及其转义字符: - "&" 转义为 "&" - "<" 转义为 "<" - ">" 转义为 ">" - "'" 转义为 "&apos;" - """ 转义为 """ 在Java中,你可以使用org.w3c.dom包中的Document和Element类来创建XML文档。在创建元素时,可以使用setAttribute方法来设置元素属性,使用appendChild方法来添加子元素。以下是一个示例代码: ``` DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.newDocument(); Element root = doc.createElement("root"); doc.appendChild(root); Element child = doc.createElement("child"); child.setAttribute("attr", "value"); root.appendChild(child); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File("file.xml")); transformer.transform(source, result); ``` 在上面的代码中,我们创建了一个根元素"root",并添加了一个名为"child"的子元素,并设置了其属性"attr"的值为"value"。最后,我们使用Transformer将Document对象输出到文件中。 如果你需要将特殊字符转义后再添加到XML文档中,可以使用以下代码: ``` Element element = doc.createElement("element"); element.setTextContent("This & that"); child.appendChild(element); ``` 在上面的代码中,我们将文本"This & that"添加到了名为"element"的元素中,"&"被自动转义为"&"。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值