replace.java
来自「一本jsp自学教材」· Java 代码 · 共 33 行
JAVA
33 行
package test;
import java.util.*;
public class Replace
{
public Replace(){}
public String RepSTR(String resource,String from,String to){
int j=0;
int i=0;
int k=0;
String newstr="";
String temp=resource;
int tagc=from.length();
while(i<resource.length()){
if(resource.substring(i).startsWith(from)){
temp=resource.substring(j,i)+to;
newstr+=temp;
i+=tagc;
j=i;
}
else
{
i+=1;
}
}
newstr+=resource.substring(j);
return newstr;
}
public String repItem(String mm){
String re1="";
re1=RepSTR(mm,"的","之");
return re1;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?