JSP处理英文字符换行问题!(急啊)
以下是我的代码,就是不能实现英文单词换行问题,请高手指点一下.谢谢!!!!!
这个是JavaBean文件,
package com.deqintrade.replace;
public final class Replace
{
public Replace()
{
}
public static String replace(String str1,String str2,String str3)
{ StringBuffer strBuf = new StringBuffer(str1);
int index=0;
while(str1.indexOf(str2,index)!=-1)
{ index=str1.indexOf(str2,index);
strBuf.replace(str1.indexOf(str2,index),str1.indexOf(str2,index)+str2.length(),str3);
index=index+str3.length();
str1=strBuf.toString();
}
return strBuf.toString();
}
}
调用replace文件.
.................................................
...............................................
............................................
从数据库中取出英文内容.
news_content=rsnews.getString("news_content");
if(news_content!=null){
news_content=Replace.replace(news_content," "," ");
news_content=Replace.replace(news_content,"\r\n","
");
}
.....................................................
..........................................
在网页上面显示内容
..........................................................................................
.........................................................
问题:
就是在换行的时候单词要被拆开,请高手帮忙解决一下,谢谢