• java 去html标签,去除字符串中的空格,回车,换行符,制表符


      public static String getonerow(String allLine,String myfind)
        {
               
                  Pattern pattern = Pattern.compile("<div class="row">.*?</div>");        
                 Matcher  matcher = pattern.matcher(allLine);
                while(matcher.find()) {
                    String  myval = matcher.group();
                    int npos=myval.indexOf(myfind);
                    if(npos>=0)
                    {
                        npos = myval.indexOf("<span class="cell value">");
                        if(npos>0)
                        {
                             String content = myval.substring(npos,myval.length());
                             content=content.replaceAll("</?[^>]+>","");   //剔出了<html>的标签
                             content=content.replace("&nbsp;","");
                             content=content.replace(".","");
                             content=content.replace(""","‘");
                             content=content.replace("'","‘");
                             content=content.replaceAll("\s*| | | ","");//去除字符串中的空格,回车,换行符,制表符
                             return content;
                        }
                    }
                }
                return "";
       
        }

  • 相关阅读:
    监控平台
    自动化配置管理
    软件课程设计(15)
    软件课程设计(14)
    软件课程设计(13)
    软件课程设计(12)
    软件课程设计(11)
    软件课程设计(10)
    软件课程设计(9)
    参考资料
  • 原文地址:https://www.cnblogs.com/zheh/p/3904180.html
Copyright © 2020-2023  润新知