上面三个是一个完整的html字符串, 也可能更多或者少点

解决方案 »

  1.   


        String replaceStr="width:100%;height :auto";
            String oldStr=new String("<p><img alt=\"\" src=\"/CKFinder/userfiles/4720/images/%E6%9C%88%E5%AB%82%E8%B5%84%E6%96%99/%E6%88%BF%E7%B4%A0%E8%90%8D%20001_%E5%89%AF%E6%9C%AC.jpg\" style=\"width: 420px; height: 281px;\" /></p>");
            //获取起始和结尾位置
            int begin=oldStr.indexOf("width");
            int end=oldStr.lastIndexOf("px");
            //获取字符串
            String newSubString=oldStr.substring(begin, end+2);
            //newString是替换后的结果
            String newString=oldStr.replace(newSubString, replaceStr);
      

  2.   

    不过这个是按每一个<p></p>为一句
    如果你这3句话是一起的,可能还得根据<p>来切割成几句
      

  3.   

    很多的话,那就在html页面中添加一个JS,用js重新设置style。这个js要放在这些图片的后面。
      

  4.   


    能费心给个例子么? 谢谢1.获得所有img对象:
       var imgs = document.getElementsByTagName('img');2.遍历imgs,设置每个img对象的style:
         imgs[0].style.cssText = "width:100%;height :auto;";  
      

  5.   

    replace
    "(?is)(?<=(width|height):)[^;\\"]+"
    "100%"