문제

I am very new to java and jsoup and cant figure one simple thing out, hope you guys can help.

This works:

Element data = doc.select("tr:contains(Findme)").first();

But how can i use string instead of static text? This wont work:

String IneedToFindThis = "Findme";
Element data = doc.select("tr:contains(IneedToFindThis)").first();
도움이 되었습니까?

해결책

String text = "findme";
Element data = doc.select(String.format("tr:contains(%s)", text)).first();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top