下标
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user