/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and returned to </P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args){
return clearHTMLToString(args,false);
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and returned to </P>
* @param args
* @param replaceNull Whether to replace tab characters such as spaces
* @return String
*/
public static String clearHTMLToString(String args,boolean replaceNull){
if((args)){
return "";
}
args= ("(?is)<(.*?)>","");
if(replaceNull){
args = ("\\s*|\t|\r|\n","");
}
return args;
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and the returned length is specified</P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args,int maxSize){
return clearHTMLToString(args, maxSize, "");
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and the returned length is specified</P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args,int maxSize,String replace){
args=clearHTMLToString(args);
if(maxSize<=0){
return args;
}
if(()<=maxSize){
return args;
}
return (0,maxSize).concat(replace);
}
/**
* Intercept the string to the specified length
* @param args
* @param maxSize
* @param replace
* @return String
*/
public static String clearHTMLToSize(String args,int maxSize,String replace){
if(()<=maxSize){
return args;
}
return (0,maxSize).concat(replace);
}
// /**
// * Read <Style> style from css style file
// * @return String
// */
// public static String getStyleToString(File file){
// Document doc=null;
// Elements fileList=null;
// try{
// doc = (file, Config.DEFAULT_TYPE);
// fileList=("style");
// String css= ();
// if(()<1){
// return css;
// }
// /*
// * Filter out comment statements
// */
// css=("(<[^>]*>)", "");
// return css;
// }catch (Exception e) {
// (e);
// }finally{
// doc=null;
// fileList=null;
// }
// return "";
// }
// /**
// * Read <Style> style from css style file
// * @return Map<String,String>
// */
// public static Map<String,String> getStyleToMap(File file){
// Map<String, String> css=new HashMap<String, String>();
// try{
// String cssStyle=getStyleToString(file);
// if(().length()<1){
// return css;
// }
// /*
// *
// */
// String[] style=("\\}");
// String[] map=new String[2];
// for (String _style : style) {
// map=_style.split("\\{");
// (map[0],map[1]);
// }
// return css;
// }catch (Exception e) {
// (e);
// }
// return css;
// }
/**
* Read CSS properties from style
* <pre>
* String style="float:left;margin:0px;font-size:12px;";
* String fontSize=(style,"font-size");</pre>
* @param style
* @param styleName
* @return String
*/
protected static String getStyleToString(String style,String styleName){
try{
Map<String,String> css=cssToMap(style);
return (styleName);
}catch (Exception e) {
(e);
}
return "";
}
public static String filterChare(String msg,String ...chars){
for(String _char:chars){
msg=(_char,"");
}
return msg;
}
public static String mapToCSS(Map<String, String> css){
StringBuffer style=new StringBuffer();
for( <String,String> entry : ()){
(()>0?",":"");
(()).append(":").append(());
}
return ();
}
/**
* Encapsulate style into key-value pairs
* <pre>
* String style="float:left;margin:0px;font-size:12px;";
* Map<String,String> css=(style);
* ("font-size:"+("font-size"));
* </pre>
* @param style
* @return Map
*/
public static Map<String, String> cssToMap(String style){
Map<String, String> map=new HashMap<String, String>();
try{
if(style==null||(style)){
return map;
}
style=();
style=("\\}")[0];
String[] csss=("\\;");
for(int i=0,iSzie=;i<iSzie;i++){
String [] cssStyle=csss[i].split("\\:");
for (int j = 0,jSize=; (j+1) < jSize; j+=2) {
(cssStyle[j].replace(" ", "").trim(), cssStyle[j+1].toString().trim());
}
}
}catch (Exception e) {
(e);
}
return map;
}
// /**
// * Read the attribute of cssName from the css style (note that css is standard css)
// * @param css
// * @param cssName
// * @param styleName
// * @return String
// */
// public static String getStyleNameValue(File file,String cssName,String styleName){
// try{
// String style=getStyleToMap(file).get(cssName);
// return getStyleNameValue(style, styleName);
// }catch (Exception e) {
// (e);
// }
// return "";
// }
}
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and returned to </P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args){
return clearHTMLToString(args,false);
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and returned to </P>
* @param args
* @param replaceNull Whether to replace tab characters such as spaces
* @return String
*/
public static String clearHTMLToString(String args,boolean replaceNull){
if((args)){
return "";
}
args= ("(?is)<(.*?)>","");
if(replaceNull){
args = ("\\s*|\t|\r|\n","");
}
return args;
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and the returned length is specified</P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args,int maxSize){
return clearHTMLToString(args, maxSize, "");
}
/**
* Clear html code
* <p>All contents included between '<' and '>' will be cleared and the returned length is specified</P>
* @param args
* @return String
*/
public static String clearHTMLToString(String args,int maxSize,String replace){
args=clearHTMLToString(args);
if(maxSize<=0){
return args;
}
if(()<=maxSize){
return args;
}
return (0,maxSize).concat(replace);
}
/**
* Intercept the string to the specified length
* @param args
* @param maxSize
* @param replace
* @return String
*/
public static String clearHTMLToSize(String args,int maxSize,String replace){
if(()<=maxSize){
return args;
}
return (0,maxSize).concat(replace);
}
// /**
// * Read <Style> style from css style file
// * @return String
// */
// public static String getStyleToString(File file){
// Document doc=null;
// Elements fileList=null;
// try{
// doc = (file, Config.DEFAULT_TYPE);
// fileList=("style");
// String css= ();
// if(()<1){
// return css;
// }
// /*
// * Filter out comment statements
// */
// css=("(<[^>]*>)", "");
// return css;
// }catch (Exception e) {
// (e);
// }finally{
// doc=null;
// fileList=null;
// }
// return "";
// }
// /**
// * Read <Style> style from css style file
// * @return Map<String,String>
// */
// public static Map<String,String> getStyleToMap(File file){
// Map<String, String> css=new HashMap<String, String>();
// try{
// String cssStyle=getStyleToString(file);
// if(().length()<1){
// return css;
// }
// /*
// *
// */
// String[] style=("\\}");
// String[] map=new String[2];
// for (String _style : style) {
// map=_style.split("\\{");
// (map[0],map[1]);
// }
// return css;
// }catch (Exception e) {
// (e);
// }
// return css;
// }
/**
* Read CSS properties from style
* <pre>
* String style="float:left;margin:0px;font-size:12px;";
* String fontSize=(style,"font-size");</pre>
* @param style
* @param styleName
* @return String
*/
protected static String getStyleToString(String style,String styleName){
try{
Map<String,String> css=cssToMap(style);
return (styleName);
}catch (Exception e) {
(e);
}
return "";
}
public static String filterChare(String msg,String ...chars){
for(String _char:chars){
msg=(_char,"");
}
return msg;
}
public static String mapToCSS(Map<String, String> css){
StringBuffer style=new StringBuffer();
for( <String,String> entry : ()){
(()>0?",":"");
(()).append(":").append(());
}
return ();
}
/**
* Encapsulate style into key-value pairs
* <pre>
* String style="float:left;margin:0px;font-size:12px;";
* Map<String,String> css=(style);
* ("font-size:"+("font-size"));
* </pre>
* @param style
* @return Map
*/
public static Map<String, String> cssToMap(String style){
Map<String, String> map=new HashMap<String, String>();
try{
if(style==null||(style)){
return map;
}
style=();
style=("\\}")[0];
String[] csss=("\\;");
for(int i=0,iSzie=;i<iSzie;i++){
String [] cssStyle=csss[i].split("\\:");
for (int j = 0,jSize=; (j+1) < jSize; j+=2) {
(cssStyle[j].replace(" ", "").trim(), cssStyle[j+1].toString().trim());
}
}
}catch (Exception e) {
(e);
}
return map;
}
// /**
// * Read the attribute of cssName from the css style (note that css is standard css)
// * @param css
// * @param cssName
// * @param styleName
// * @return String
// */
// public static String getStyleNameValue(File file,String cssName,String styleName){
// try{
// String style=getStyleToMap(file).get(cssName);
// return getStyleNameValue(style, styleName);
// }catch (Exception e) {
// (e);
// }
// return "";
// }
}