当前位置: 技术问答>java相关
在JSP中怎么实现折行??
来源: 互联网 发布时间:2015-04-27
本文导语: 在ASP中的折行只要一句:content=replace(rs("grrz"),chr(13)&chr(10),"") 请问:JSP要怎么实现??????? | public static final String replace(String strSource, String strFrom, String strTo) { if(strFrom ==...
在ASP中的折行只要一句:content=replace(rs("grrz"),chr(13)&chr(10),"
")
请问:JSP要怎么实现???????
")
请问:JSP要怎么实现???????
|
public static final String replace(String strSource, String strFrom, String strTo)
{
if(strFrom == null || strFrom.equals(""))
return strSource;
String strDest = "";
int intFromLen = strFrom.length();
int intPos;
while((intPos = strSource.indexOf(strFrom)) != -1)
{
strDest = strDest + strSource.substring(0,intPos);
strDest = strDest + strTo;
strSource = strSource.substring(intPos + intFromLen);
}
strDest = strDest + strSource;
return strDest;
}
{
if(strFrom == null || strFrom.equals(""))
return strSource;
String strDest = "";
int intFromLen = strFrom.length();
int intPos;
while((intPos = strSource.indexOf(strFrom)) != -1)
{
strDest = strDest + strSource.substring(0,intPos);
strDest = strDest + strTo;
strSource = strSource.substring(intPos + intFromLen);
}
strDest = strDest + strSource;
return strDest;
}