[网页高手]
Homepage
[网络编程]
Programe
[图形图像]
Picture
[冲浪宝典]
Insernet
[操作系统]
System
[软件教学]
Software
[数码时代]
Didgtale
[安全防御]
Didgtale
[IT学院]
Education
    
 
Google Web tongyi.net
 
    你的位置:首页 > 网络编程 > 其它编程 > java中关于html的转换
网络编程
  ASP

PHP

JSP

CGI

ASP.NET

C#.NET

SQL Server

Mysql

ORACLE

其它编程

 
java中关于html的转换

请看下面这个例子 
 public static String escapeHTMLTags( String input ) { 
    // Check if the string is null or zero length -- if so, return what was sent in. 
    if( input == null || input.length() == 0 ) { 
      return input; 
    } 
    // Use a StringBuffer in lieu of String concatenation -- it is much more efficient this way. 
    StringBuffer buf = new StringBuffer(); 
    char ch = \' \'; 
    for( int i=0; i<input.length(); i++ ) { 
      ch = input.charAt(i); 
      if( ch == \'<\' ) { 
        buf.append( \"<\" ); 
      } 
      else if( ch == \'>\' ) { 
        buf.append( \">\" ); 
      } 
      else { 
        buf.append( ch ); 
      } 
    } 
    return buf.toString(); 
  } 
     打印本文 | 推荐朋友 | 收藏文章 | 关闭窗口
 
 

    相关文章
 利用JDOM开发日文外来语网路电子辞典    (2001年11月21日)

 利用EJB创建CRM系统    (2001年11月21日)

 Visual C#中轻松浏览数据库记录    (2001年11月19日)

 用Visual C#获得计算机名称和IP地址    (2001年11月18日)

 基于EJB技术的商务预订系统的开发    (2001年11月14日)

 在Visual Basic中用DDE实现报警控制    (2001年11月14日)

 Visual C#的菜单编程    (2001年11月13日)

 使用delphi来实现三种功能    (2001年11月5日)

 
 

 

关于统一 | 联系合作 | 统一作品 | 版权申明 | 建站服务 | 更多说明
Copyright 2000-2003 Tongyi All rights reserved. 京ICP备05005608号