ASP去掉字符串头尾连续回车和空格的Function

所属分类: 网络编程 / ASP编程 阅读数: 1130
收藏 0 赞 0 分享

复制代码 代码如下:

'去掉字符串头尾的连续的回车和空格
function trimVBcrlf(str)
trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))
end function

'去掉字符串开头的连续的回车和空格
function ltrimVBcrlf(str)
dim pos,isBlankChar
pos=1
isBlankChar=true
while isBlankChar
if mid(str,pos,1)=" " then
pos=pos+1
elseif mid(str,pos,2)=VBcrlf then
pos=pos+2
else
isBlankChar=false
end if
wend
ltrimVBcrlf=right(str,len(str)-pos+1)
end function

'去掉字符串末尾的连续的回车和空格
function rtrimVBcrlf(str)
dim pos,isBlankChar
pos=len(str)
isBlankChar=true
while isBlankChar and pos>=2
if mid(str,pos,1)=" " then
pos=pos-1
elseif mid(str,pos-1,2)=VBcrlf then
pos=pos-2
else
isBlankChar=false
end if
wend
rtrimVBcrlf=rtrim(left(str,pos))
end function

更多精彩内容其他人还在看

IIS访问ASP页面时报错The requested resource is in use.的解决办法

IIS访问ASP页面时报错The requested resource is in use.的解决办法
收藏 0 赞 0 分享

错误类型:Provider (0x80004005)未指定的错误 的一个处理方法

一般情况下asp可以正常运行,但只要连接数据库就提示,Microsoft JET Database Engine 错误'80004005'
收藏 0 赞 0 分享

关于“未指定的错误”的问题 的比较正解的解决方法

关于“未指定的错误”的问题 的比较正解的解决方法
收藏 0 赞 0 分享

关于asp+access的安全问题分析

关于asp+access的安全问题分析
收藏 0 赞 0 分享

把RS.GetRows看得更清楚

把RS.GetRows看得更清楚
收藏 0 赞 0 分享

ASP面向对象编程探讨及比较

ASP面向对象编程探讨及比较
收藏 0 赞 0 分享

ASP错误处理

ASP错误处理
收藏 0 赞 0 分享

web文件管理器的后续开发

web文件管理器的后续开发
收藏 0 赞 0 分享

上一篇,下一篇过程代码

上一篇,下一篇过程代码
收藏 0 赞 0 分享

一小偷类!!有兴趣的可以看看

一小偷类!!有兴趣的可以看看
收藏 0 赞 0 分享
查看更多