首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

asp中Replace的用法有关问题,望大家解答,

2012-01-28 
asp中Replace的用法问题,望大家解答,在线等....就是语句中的string(len(bad(i))怎么理解啊?????functiondo

asp中Replace的用法问题,望大家解答,在线等....
就是语句中的string(len(bad(i))怎么理解啊?????
function   doReplace(strRep)
dim   strTest,bad,i
strTest= "你好|明天|今天|后天|想你 "
  bad   =   split(strTest, "| ")
for   i=0   to   ubound(bad)
strRep=Replace(strRep,bad(i),string(len(bad(i)), "× "))
next
Response.Write(strRep)
end   function

doReplace( "我想你在明天你的会明白今天 ")

%>

[解决办法]
function doReplace(strRep)
dim strTest,bad,i
strTest= "你好|明天|今天|后天|想你 "
bad = split(strTest, "| ")
for i=0 to ubound(bad)
strRep=Replace(strRep,bad(i),string(len(bad(i)), "× "))
'在strRep中寻找bad(i)
'并用string(len(bad(i)), "× ")替换
'也就是长度为len(bad(i)的多个 "× "
next
Response.Write(strRep)
end function

热点排行