復制代碼 代碼如下:
<%
'功能:在一個字符串前後補全另一字符串
'來源:http://jorkin.reallydo.com/article.asp?id=452
Public Function Fill(ByVal sString, ByVal sStr)
Fill = RFill(LFill(sString, sStr), sStr )
End Function
%>
復制代碼 代碼如下:
<%
'功能:在一個字符串前面補全另一字符串
'來源:http://jorkin.reallydo.com/article.asp?id=452
Public Function LFill(ByVal sString, ByVal sStr)
Dim iStrLen : iStrLen = Len(sStr&"")
For i = iStrLen To 1 Step -1
If Right(sStr, i ) = Left(sString, i ) Then Exit For
Next
LFill = Left(sStr, iStrLen - i) & sString
End Function
%>
復制代碼 代碼如下:
<%
'功能:在一個字符串後面補全另一字符串
Public Function RFill(ByVal sString, ByVal sStr)
Dim iStrLen : iStrLen = Len(sStr&"")
For i = iStrLen To 1 Step -1
If Left(sStr, i) = Right(sString, i) Then Exit For
Next
RFill = sString & Mid(sStr, i + 1)
End Function
%>
例如:
<%=RFill(LFill("www.jb51.net/article.asp","http://"),"article.asp?id=452")%>