程序员

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

作者:admin 2021-06-15 我要评论

复制代码 代码如下: '去掉字符串头尾的连续的回车和空格 function trimVBcrlf(str) trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str)) end function '去掉字符串开头的...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

复制代码 代码如下:

'去掉字符串头尾的连续的回车和空格
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


原文链接:https://m.jb51.net/article/16879.htm

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • ASP去掉字符串头尾连续回车和空格的Fun

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

  • ASP IE地址栏参数的判断

    ASP IE地址栏参数的判断

  • ASP也使用ORM,给ASP上所有的SQL注入画

    ASP也使用ORM,给ASP上所有的SQL注入画

  • asp select下拉菜单选择图标并实时显示

    asp select下拉菜单选择图标并实时显示

腾讯云代理商
精彩导读
海外云服务器
热门资讯
腾讯云代理商