加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

利用asp语言实现的 string completion()

发布时间:2023-11-28 11:53:59 所属栏目:Asp教程 来源:
导读:复制代码 代码如下:
<%
&#39;功能:在一个字符串前后补全另一字符串
&#39;来源:http://jorkin.reallydo.com/article.asp?id=452

Public Function Fill(ByVal sString, ByVal sStr)
Fill = RFill(LFill
复制代码 代码如下:
<% 
'功能:在一个字符串前后补全另一字符串 
'来源: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.Cuoxin.com/article.asp","http://"),"article.asp?id=452")%>

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章