-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOCExtractor.java
More file actions
50 lines (45 loc) · 1.44 KB
/
Copy pathDOCExtractor.java
File metadata and controls
50 lines (45 loc) · 1.44 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by sm-user on 10.11.2016.
*/
public class DOCExtractor {
public String extractLinkOpen(String DOCText) {
String PATTERN = "(\"http([^\"]*\"))";
Pattern pattern = Pattern.compile(PATTERN);
Matcher matcher = pattern.matcher(DOCText);
String link = null;
while (matcher.find()) {
link = matcher.group();
link = link.replace("\"", "");
link = link.replace("\"", "");
}
return link;
}
public Double extractTime (String DOCText) {
String PATTERN = "(\"[0-9]+(.[0-9]+)?\")";
Pattern pattern = Pattern.compile(PATTERN);
Matcher matcher = pattern.matcher(DOCText);
String link = null;
double time = 0;
while (matcher.find()) {
link = matcher.group();
link = link.replace("\"", "");
link = link.replace("\"", "");
time = Double.parseDouble(link);
}
return time;
}
public String extractLink(String DOCText) {
String PATTERN = "(\"([^\"]*\"))";
Pattern pattern = Pattern.compile(PATTERN);
Matcher matcher = pattern.matcher(DOCText);
String link = null;
while (matcher.find()) {
link = matcher.group();
link = link.replace("\"", "");
link = link.replace("\"", "");
}
return link;
}
}