com.gitee.fufu669.utils.CacheHtmlUtil Maven / Gradle / Ivy
package com.gitee.fufu669.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @author wangfupeng */
public class CacheHtmlUtil {
public static final Logger logger = LoggerFactory.getLogger(CacheHtmlUtil.class);
public static String getHtmlString(String originalString, String leftString, String rightString, Integer leftArrayIndex, Integer rightArrayIndex){
try {
String[] strings = originalString.split(leftString);
String[] strings1 = strings[leftArrayIndex].split(rightString);
return strings1[rightArrayIndex];
} catch (Exception e) {
return "";
}
}
public static String getLastStringSplitHtml(String originalString, String splitString){
try {
String[] strings = originalString.split(splitString);
return strings[strings.length-1];
} catch (Exception e) {
return "";
}
}
public static String getWordsFromHtml(String html){
return html.replaceAll("<.*?>", "");
}
public static String getStringWithoutEmpty(String name) {
name = name.replaceAll(" ", "");
name = name.replaceAll(" ", "");
name = name.replaceAll("\n", "");
name = name.replaceAll(" ", "");
return name;
}
public static String toLowerCaseAtFirstCharacter(String tableName) {
StringBuilder sb = new StringBuilder(tableName);
sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
return sb.toString();
}
public static String toUpperCaseAtFirstCharacter(String tableName) {
StringBuilder sb = new StringBuilder(tableName);
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
return sb.toString();
}
}