asp下實現(xiàn)字符串的補充fill()
更新時間:2008年02月15日 16:10:58 作者:
在一個字符串前后補全另一字符串,在一個字符串前面補全另一字符串,在一個字符串后面補全另一字符串
復制代碼 代碼如下:
<%
'功能:在一個字符串前后補全另一字符串
'來源: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.dbjr.com.cn/article.asp","http://"),"article.asp?id=452")%>
相關(guān)文章
利用ASP從遠程服務器上接收XML數(shù)據(jù)的方法
利用ASP從遠程服務器上接收XML數(shù)據(jù)的方法...2007-01-01asp下實現(xiàn)格式化文件大小以MB顯示的函數(shù)
asp下實現(xiàn)格式化文件大小以MB顯示的函數(shù)...2007-08-08asp中去除html中style,javascript,css代碼
剔除頁面中html中除文字以外的任何代碼,剛才發(fā)布了php版這個是ASP中的版本。2010-10-10