scinfu/SwiftSoup

Have 3 <p> and need to display separately

nandarosyadi opened this issue · 1 comments

Hi guys, I've been research to split the part of html string. Here is the html code
<p>Soal 1 dengan gambar</p>\n<p><img src=\"https://dian-media-staging-jakarta.s3.ap-southeast-3.amazonaws.com/media/WsywigImages/2023/05/24/015AC8AD-64E5-4E88-BE66-A4E8DE7D0CFA_Ijvbkm5.jpg\" alt=\"\" width=\"720\" height=\"900\"></p>\n<p>Ada soal lagi disini</p>

I've succed to split the image string, with this code
let htmlDoc = try SwiftSoup.parse(htmlString) guard let imgSrc = try htmlDoc.select("img").first() else { return } let image: String = try imgSrc.attr("src")
will return https://dian-media-staging-jakarta.s3.ap-southeast-3.amazonaws.com/media/WsywigImages/2023/05/24/015AC8AD-64E5-4E88-BE66-A4E8DE7D0CFA_Ijvbkm5.jpg

Now, I am trying to split the

part. Anyone can help for this? Thank you

I just read this issue, and it solve now