2012-03-12 113 views
0

我有这样的HTML字符串:存储一个巨大的HTML字符串在一个字符串变量

<h1>MDPI Open Access Information and Policy</h1> 

<div class="info-intro">All articles published by MDPI are made available under an open access license worldwide immediately. This means: 
<ul>  

而且我想这些信息存储在一个字符串:

String abaut="<h1>MDPI Open Access Information and Policy</h1> 

<div class="info-intro">All articles published by MDPI are made available under an open access license worldwide immediately. This means: 
<ul>"; 

,我gotting一些问题:字符串不被接受,因为字符串内部有一些新的行,我怎样才能做到这一点?

+1

'我正在gotting一些problems'非常好的问题描述! – WarrenFaith 2012-03-12 12:20:23

+0

抱歉@WarrenFaith,我编辑了我的问题。 – 2012-03-12 12:22:14

+1

用\“ – 2012-03-12 12:31:25

回答

4

可能你需要在你的字符串中跳过"使用改为。

样品:

String abaut="<h1>MDPI Open Access Information and Policy</h1>" + 
"<div class=\"info-intro\">All articles published by MDPI are made available under an open access license worldwide immediately. This means: <ul>"; 
+0

转义它太好了,谢谢。 – 2012-03-12 12:30:27

+0

或者你可以在html代码中使用'char – sherif 2012-03-12 20:27:51

相关问题