我已经创建了下面的字符串。创建一个串联的字符串
The <a target="" href="http://google.com/search=xyz">xyz</a><a target="" href="http://google.com/search=xyz"><img src="http://google.com/small.gif" alt="" title="smallimage" border="0"></a> has all the search info.
我正在尝试如下操作。
String X = "The <a target="" href="http://google.com/search=xyz">xyz</a><a target="" href="http://google.com/search=xyz"><img src="http://google.com/small.gif" alt="" title="smallimage" border="0"></a> has all the search info."
但它是扔我语法错误。
这里我创建了另一个名为searchTerm的String,如下所示。
String searchTerm = "Hello";
我想通过如下所示的串联来创建最终的字符串。
String X = "The <a target="" href="http://google.com/search="+searchTerm+"">xyz</a><a target="" href="http://google.com/search="+searchTerm+""><img src="http://google.com/small.gif" alt="" title="smallimage" border="0"></a> has all the search info."
甚至这是行不通的。
请让我知道我该如何解决这个问题。
在这里,我甚至感到困惑<and>
标签,不仅是引号
感谢
你想读取一些html或将它用于其他目的 –
使用'String.format()'更好,更易读。 –