zoukankan      html  css  js  c++  java
  • html文本存入数据库,特殊字符转换

    package Controller;
    
    public class TranslationStr {
        public String HtmltoStr(String newText) {
            
           // newText = newText.replace("
    ", "<br>");
              //textBox里的换行是用
    来表示的,如果要在HTML里显示换行要用<br>
            newText = newText.replace("<", "&lt");  //置换 <
            newText = newText.replace(">", "&gt");  //置换 >
            newText=newText.replace("/", "&frasl");
              
            return newText;    
        }
        public String StrtoHtml(String newText) {
            //newText = newText.replace("<br>", "
    ");  
            newText = newText.replace("&lt", "<");    
            newText = newText.replace("&gt", ">"); 
            newText=newText.replace("&frasl","/");
            return newText;
        }
    
            
    }
  • 相关阅读:
    UVA
    BZOJ 2330: [SCOI2011]糖果
    人类的殒落与扬升
    算法笔记2
    算法笔记
    回溯法
    贪心法
    动态规划
    分治与递归
    计算机图形学 补 光线跟踪
  • 原文地址:https://www.cnblogs.com/ZCM98/p/12482400.html
Copyright © 2011-2022 走看看