当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp下实现字符串的补充fill()

ASP
javascript css 三级目录(简单的)
asp下sql和access数据库随机取10条记录的代码newid()
新增加一个防垃圾评论的asp代码,鄙视垃圾
asp ADO GetString函数与用GetString来提高ASP的速度
windows2003下使用asp WScript.Shell的设置方法
asp UTF-8 乱码问题的解决方法小结
JavaScript面向对象的两种书写方法以及差别
响应对象 错误 ''ASP 0185 : 80020003'' 缺少默认属性
ASP生成伪参数程序设计技巧
asp中使用mysql数据库的注意实现
使用FSO修改文件夹的名称实现文件转移防盗链
asp下request.querystring("id")与request("id")区别
asp将全角的字符转变成半角字符,将半角转变成全角d的代码
asp创建表,复制表 字段类型附录
asp加密解密函数decrypt
asp获取当前网页地址的代码
asp下经常用到的代码
asp 的中文分词
修改正确的asp冒泡排序
rustysun同学ASP代码书写规范

ASP 中的 asp下实现字符串的补充fill()


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 33 ::
收藏到网摘: n/a

在一个字符串前后补全另一字符串,在一个字符串前面补全另一字符串,在一个字符串后面补全另一字符串
复制代码 代码如下:

<%
'功能:在一个字符串前后补全另一字符串
'来源: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.ruanchen.com/","http://"),"article.asp?id=452")%>