程序包 org.anyline.util

类 HtmlUtil

java.lang.Object
org.anyline.util.HtmlUtil

public class HtmlUtil extends Object
  • 构造器详细资料

    • HtmlUtil

      public HtmlUtil()
  • 方法详细资料

    • display

      public static String display(String src)
    • name2code

      public static String name2code(String src)
    • code2display

      public static String code2display(String src)
    • table

      public static String table(String cells, int cols, String split)
      根据单元格内容生成表格
      什么情况下需要, 通过OCR识别内容时, 如果原文是表格形式, 识别出来的结果排列会乱
       如:原文是这样
       ---------------
       | A | B | C |
       ---------------
       | 1 | 2 | 3 |
       ---------------
       识别结果可能会是这样
       A
       B
       C
       1
       2
       3
       这时需要HtmlUtil.table(String 识别结果, int 每行几列, String 分隔符)
       把识别出来的内容还原成表格形式
       
      参数:
      cells - 单元格内容
      cols - 每行cols列
      split - 分隔符号
      返回:
      table
    • table

      public static String table(String cells, int cols)
       单元格内容生成表格
       默认换行分隔 \n
       
      参数:
      cells - 单元格内容
      cols - 每行cols列
      返回:
      table
    • cut

      public static String cut(String html, int fr, int to)
      截取html, 截取to位置所在的第一层标签的结束位置, 避免拆破标签, 不支持多层嵌套结构
      参数:
      html - html
      fr - fr
      to - to
      返回:
      String