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