大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> JSP专区 -> JSP中的字符替换函数 str_replace() 实现! 

JSP中的字符替换函数 str_replace() 实现! 

时间: 2021-07-31 作者:daque

//// strreplace.java//package forum;import java.util.*;/*** title:* description:* copyright: copyright (c) 2001* company:* @author* @version 1.0*/public class strreplace {public strreplace() {}public string str_replace(string from,string to,string source){stringbuffer bf= new stringbuffer("");stringtokenizer st = new stringtokenizer(source,from,true);while (st.hasmoretokens()){string tmp = st.nexttoken();system.out.println("*"+tmp);if(tmp.equals(from)){bf.append(to);}else{bf.append(tmp);}}return bf.tostring();}}// 运用本领<jsp:usebean id="replace" scope="page" class="forum.strreplace" /><%= replace.str_replace("<","^","<h1>123456</h1>") %> 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.