加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

JSP上关于html的转换

发布时间:2023-05-22 14:01:27 所属栏目:教程 来源:
导读: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 i
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; ich = input.charat(i);
 
if( ch == ´<´ ) {
 
buf.append( "<" );
 
}
 
else if( ch == ´>´ ) {
 
buf.append( ">" );
 
}
 
else {
 
buf.append( ch );
 
}
 
}
 
return buf.tostring();
 
}
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!