O
O
onlinejunior2020-06-20 00:42:01
go
onlinejunior, 2020-06-20 00:42:01

How can I get the first value?

I'm trying to get the value from the following html:


<div class="new">
<span>
117
</span>
<span class="r">i</span>
</div>


GO code:

s.HTMLDoc.Find(".new span").Text()

I get the following:

117 i

How do I get only 117 ?

PS I use goquery

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Samsonov, 2020-06-20
@onlinejunior

doc.Find(".new span").First().Text()
https://play.golang.org/p/Ti1houS29fJ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question