-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinks.java
More file actions
31 lines (31 loc) · 849 Bytes
/
Copy pathLinks.java
File metadata and controls
31 lines (31 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
public class Links {
String html = "";
public String toString() {
return html;
}
public String getHtml() {
return html;
}
public void setHtml(String html) {
this.html = html;
}
public Links(String html) {
this.html = html;
}
public boolean hasNext() {
return html.contains("<a target=\"_blank\" rel=\"noopener\" class=\"link-gruen bold\" href=\"");
}
public String next() {
String link = "";
String key = "<a target=\"_blank\" rel=\"noopener\" class=\"link-gruen bold\" href=\"";
int von;
von = html.indexOf(key) + key.length();
int bis = von;
while (bis < html.length() && html.charAt(bis) != '"') {
++bis;
}
link = html.substring(von, bis);
html = html.replaceFirst("<a target=\"_blank\" rel=\"noopener\" class=\"link-gruen bold\" href=\"", "");
return link;
}
}