JSP 의 문자 교체 함수 strreplace()실현!

//// 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();}}// 사용 방법<%=replace.strreplace("<","^","

123456

") %>

좋은 웹페이지 즐겨찾기