开发者

Android, parsing html, problem with strings in strings

开发者 https://www.devze.com 2023-02-05 14:58 出处:网络
Im trying to parse some html code line by line. However, when i search for a line that start with <td class=\"departure\", i cant manage to syntax it correctly because of the string delimiter signs

Im trying to parse some html code line by line. However, when i search for a line that start with <td class="departure", i cant manage to syntax it correctly because of the string delimiter signs (") (what is the name of this sign in english anyway?) in the html. It sees two strings and departure as a variable in开发者_StackOverflow社区 between.

Can anyone help me with this?

if (line.startsWith("   <td class="departure"")){

   result += Html.fromHtml(line) + " ";
}


Escape that character (it's called quotes) by using \:

if (line.startsWith("   <td class=\"departure\"")){

   result += Html.fromHtml(line) + " ";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消