Home > Database > Mysql Tutorial > JSP中的字符替换函数 str_replace() 实现! _MySQL

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 14:09:29
Original
1343 people have browsed it

//
// 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();
}
}


// 使用方法

123456") %> 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
ubuntu mongodb 出现 exception: connect failed
From 1970-01-01 08:00:00
0
0
0
An error occurred
From 1970-01-01 08:00:00
0
0
0
Why does clicking login jump to hello world?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template