You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
package ru.defend.defdevteam.tstu;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
|
|
/**
|
|
* Created by itsmy on 10.02.2017.
|
|
*/
|
|
|
|
public class OldParser {
|
|
|
|
public static StringBuffer removeUTFCharacters(String data){
|
|
Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})");
|
|
Matcher m = p.matcher(data);
|
|
StringBuffer buf = new StringBuffer(data.length());
|
|
while (m.find()) {
|
|
String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16));
|
|
m.appendReplacement(buf, Matcher.quoteReplacement(ch));
|
|
}
|
|
m.appendTail(buf);
|
|
return buf;
|
|
}
|
|
|
|
public String cutLine(String a, String b, String Line){
|
|
if(Line.contains(a)) Line = Line.substring(Line.indexOf(a)+ a.length());
|
|
if(Line.contains(b)) {
|
|
if(b == ""){
|
|
return Line;
|
|
}
|
|
Line = Line.substring(0, Line.indexOf(b));
|
|
return Line;
|
|
} else {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public String cutLine(String a, String b, String Line, boolean hard){
|
|
if ((!Line.contains(a)) || (a.equals("")) ) return "";
|
|
if ((!Line.contains(b)) || (b.equals("")) ) return "";
|
|
Line = Line.substring(Line.indexOf(a)+ a.length());
|
|
Line = Line.substring(0, Line.indexOf(b));
|
|
return Line;
|
|
}
|
|
|
|
}
|
|
|