This commit is contained in:
limqhz
2022-05-11 22:47:44 +08:00
parent 03d805641a
commit 4eadfe16f3
30 changed files with 2252 additions and 119 deletions

View File

@@ -7,20 +7,31 @@ import org.springframework.util.CollectionUtils;
import java.util.List;
public interface ContentUtil {
public class ContentUtil {
static String toTextContentFromWangEdit(String wangEdit){
public static String toTextContentFromWangEdit(String wangEdit){
List<WangEdit> decode = JsonUtils.decode(wangEdit, new TypeReference<List<WangEdit>>(){});
StringBuffer sb = new StringBuffer();
decode.forEach(x->{
List<EditText> children = x.getChildren();
if (!CollectionUtils.isEmpty(children)){
children.forEach(y ->{
sb.append(y.getText());
getChildText(sb,y);
});
}
});
return sb.toString();
}
private static void getChildText(StringBuffer sb, EditText editText){
List<EditText> children = editText.getChildren();
if (!CollectionUtils.isEmpty(children)){
children.forEach(y ->{
getChildText(sb,y);
});
}else {
sb.append(editText.getText());
}
}
}