|
|
|
@ -46,6 +46,14 @@ public class ShowValueUtils {
|
|
|
|
|
public static final int HTML_TAIL_LEN = HTML_TAIL.length(); |
|
|
|
|
public static final int NOBR_LEN = NOBR.length(); |
|
|
|
|
public static final int NOBR_TAIL_LEN = NOBR_TAIL.length(); |
|
|
|
|
/** |
|
|
|
|
* <转变为<的长度差 |
|
|
|
|
*/ |
|
|
|
|
public static final int LEFT_DIFFERENT = 3; |
|
|
|
|
/** |
|
|
|
|
* >转变为>的长度差 |
|
|
|
|
*/ |
|
|
|
|
public static final int RIGHT_DIFFERENT = 2; |
|
|
|
|
|
|
|
|
|
public static Pattern containPattern; |
|
|
|
|
private static List<String> specialCharList = new ArrayList<>(); |
|
|
|
@ -168,7 +176,6 @@ public class ShowValueUtils {
|
|
|
|
|
String ans = HEAD + replaceAll(str, searchStr, FONT_HEAD + changeHtmlStr(searchStr) + FONT_TAIL) + TAIL; |
|
|
|
|
return changeOriginHtmlStr(ans); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -176,14 +183,13 @@ public class ShowValueUtils {
|
|
|
|
|
*/ |
|
|
|
|
private static String changeOriginHtmlStr(String str) { |
|
|
|
|
int count = 0; |
|
|
|
|
int different = 3; |
|
|
|
|
StringBuilder builder = new StringBuilder(str); |
|
|
|
|
for (int i = 0; i < str.length(); i++) { |
|
|
|
|
char c = str.charAt(i); |
|
|
|
|
if (c == LEFT_HTML_CHAR) { |
|
|
|
|
if (!checkValid(str, i)) { |
|
|
|
|
builder.replace(i + count, i + count + 1, "<"); |
|
|
|
|
count += different; |
|
|
|
|
count += LEFT_DIFFERENT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -232,14 +238,12 @@ public class ShowValueUtils {
|
|
|
|
|
|
|
|
|
|
private static int getIncreaseCount(String str) { |
|
|
|
|
int count = 0; |
|
|
|
|
int leftDifferent = 3; |
|
|
|
|
int rightDifferent = 2; |
|
|
|
|
for (int i = 0; i < str.length(); i++) { |
|
|
|
|
if (str.charAt(i) == LEFT_HTML_CHAR) { |
|
|
|
|
count += leftDifferent; |
|
|
|
|
count += LEFT_DIFFERENT; |
|
|
|
|
} |
|
|
|
|
if (str.charAt(i) == RIGHT_HTML_CHAR) { |
|
|
|
|
count += rightDifferent; |
|
|
|
|
count += RIGHT_DIFFERENT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return count; |
|
|
|
|