|
@@ -19,8 +19,9 @@ public class ItemParser {
|
19
|
19
|
}
|
20
|
20
|
|
21
|
21
|
public ArrayList<String> parseRawDataIntoStringArray(String rawData) {
|
|
22
|
+ String rawDataFix = rawData.substring(0, rawData.length()-2);
|
22
|
23
|
String stringPattern = "##";
|
23
|
|
- ArrayList<String> response = splitStringWithRegexPattern(stringPattern, rawData);
|
|
24
|
+ ArrayList<String> response = splitStringWithRegexPattern(stringPattern, rawDataFix);
|
24
|
25
|
return response;
|
25
|
26
|
}
|
26
|
27
|
|
|
@@ -39,14 +40,20 @@ public class ItemParser {
|
39
|
40
|
return matcher.replaceAll("o");
|
40
|
41
|
}
|
41
|
42
|
|
|
43
|
+ public String fixLeftOverHashes(String s){
|
|
44
|
+ Pattern pattern = Pattern.compile("[##]");
|
|
45
|
+ Matcher matcher = pattern.matcher(s);
|
|
46
|
+ return matcher.replaceAll("");
|
|
47
|
+ }
|
|
48
|
+
|
42
|
49
|
public LinkedHashMap<String, String> getKeyValueEntries(String valuePair) {
|
43
|
50
|
ArrayList<String> keyValuePairs = findKeyValuePairsInRawItemData(valuePair);
|
44
|
51
|
LinkedHashMap<String, String> itemDescription = new LinkedHashMap<String, String>();
|
45
|
52
|
for (String keyValues : keyValuePairs) {
|
46
|
53
|
ArrayList<String> keyAndValue = splitKeysAndValue(keyValues);
|
47
|
|
- if(keyAndValue.size() == 2) {
|
|
54
|
+ if (keyAndValue.size() == 2) {
|
48
|
55
|
itemDescription.put(keyAndValue.get(0).toLowerCase(), keyAndValue.get(1).toLowerCase());
|
49
|
|
- }else{
|
|
56
|
+ } else {
|
50
|
57
|
itemDescription.put(keyAndValue.get(0).toLowerCase(), null);
|
51
|
58
|
}
|
52
|
59
|
}
|