Java修改带回显吗_修改的是根据自定义标签进行处理回显

/**

*

* @Title: findByIdChengStr

* @Description: TODO

* @author 凯哥Java

* @param editContentStr

* @return

* @return String

* @throws

*/

private String findByIdChengStr(String str,String Vpath) {

String [] pathArr = Vpath.split(",");

String regStr1 = "([\\s\\S]*?)";

Pattern r1 = Pattern.compile(regStr1);

Matcher m1 = r1.matcher(str);

List listBean = new ArrayList();

while(m1.find()){

String oldStr = m1.group(0);

listBean.add(new VoidBean(0,0,null,m1.group(0)));

}

for (int i = 0; i

StringBuilder sbs = new StringBuilder(str);

VoidBean bean = listBean.get(i);

String preStr = bean.getOldStr();

String url = preStr.substring(0,preStr.length()-2);

String beannewStr =pathArr[i];// bean.getNewStr();

String oldStr = bean.getOldStr();

int  length = str.indexOf(oldStr);//因为是从开始计数,所以加1

int  end   = length+url.length()+2;//取得结束位置

String newStr = "

"+beannewStr+"
";

sbs.replace(length, end, newStr);

str= sbs.toString();

}

return str;

/**

String regStr = "";

String urlStr = "src=\"([\\s\\S]*?)\"";

Pattern r = Pattern.compile(regStr);

Pattern urlr = Pattern.compile(urlStr);

Matcher m = r.matcher(str);

List listBean = new ArrayList();

while(m.find()){

String oldStr = m.group(0);

// System.out.println("oldStr:"+oldStr);

//

Matcher mUrl = urlr.matcher(oldStr);

if(mUrl.find()){

String url = mUrl.group(0);

// System.out.println("url:"+url);

// src="http://10.10.10.242:82/kaigejava/roadshow/product4.mp4"

url=url.substring(5, url.length()-1);

//  System.out.println("处理后的url:"+url);

//处理后的url:http://10.10.10.242:82/kaigejava/roadshow/product4.mp4

listBean.add(new VoidBean(0,0,url,m.group(0)));

}

}

for (int i = 0; i

StringBuilder sbs = new StringBuilder(str);

VoidBean bean = listBean.get(i);

String preStr = bean.getOldStr();

String url = preStr.substring(0,preStr.length()-2);

String beannewStr = bean.getNewStr();

String oldStr = bean.getOldStr();

int  length = str.indexOf(oldStr);//因为是从开始计数,所以加1

int  end   = length+url.length()+2;//取得结束位置

String newStr = "

"+beannewStr+"
";

sbs.replace(length, end, newStr);

str= sbs.toString();

}

return str;

**/

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值