Strip all paras

This commit is contained in:
Grahame Grieve 2023-05-23 17:41:16 +10:00
parent c48fd2b818
commit 0bcb2ab268

View File

@ -1951,6 +1951,30 @@ public class Utilities {
return p;
}
public static String stripAllPara(String p) {
if (noString(p)) {
return "";
}
p = p.trim();
if (p.startsWith("<p>")) {
p = p.substring(3);
}
if (p.endsWith("</p>")) {
p = p.substring(0, p.length()-4);
}
p = p.replace("</p>", " ");
p = p.replace("<p>", "");
while (p.contains("<p ")) {
int start = p.indexOf("<p ");
int end = start;
while (end < p.length() && p.charAt(end) != '>') {
end++;
}
p = p.substring(start, end);
}
return p;
}
//public static boolean !isWhitespace(String s) {