⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func.jsp

📁 绿叶OA王网络办公系统体验中心服务器已开通
💻 JSP
字号:
<%!
  public static String toHtml(String s) {
      s = Replace(s,"&","&amp;");
      s = Replace(s,"<","&lt;");
      s = Replace(s,">","&gt;");
      s = Replace(s,"\t","    ");
      s = Replace(s,"\r\n","\n");
      s = Replace(s,"\n","<br>");
      s = Replace(s," ","&nbsp;");
      s = Replace(s,"'","&#39;");
      s = Replace(s,"\\","&#92;");
      return s;
    }
    //字符串本身有replace函数。
    public static String Replace(String source,String oldString,String newString) {
      if(source == null) return null;
      StringBuffer output = new StringBuffer();
      int lengOfsource = source.length();
      int lengOfold = oldString.length();
      int posStart = 0;
      int pos;
      while((pos = source.indexOf(oldString,posStart)) >= 0) {
        output.append(source.substring(posStart,pos));
        output.append(newString);
        posStart = pos + lengOfold;
      }
      if(posStart < lengOfsource) {
        output.append(source.substring(posStart));
      }
      return output.toString();
  }
  public static String toEnHtml(String s) {
      s = Replace(s,"&amp;","&");
      s = Replace(s,"&lt;","<");
      s = Replace(s,"&gt;",">");
      s = Replace(s,"    ","\t");
      s = Replace(s,"\n","\r\n");
      s = Replace(s,"<br>","\n");
      s = Replace(s,"&nbsp;"," ");
      s = Replace(s,"&#39;","'");
      s = Replace(s,"&#92;","\\");
      return s;
    }
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -