我有这个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>";
我遇到了一些问题:字符串不被接受,因为一些字符串内部和一些新行。我怎么能这样做?
答案 0 :(得分: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>";