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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-17 我要评论
想了解ASP去掉字符串头尾连续回车和空格的Function的相关内容吗,在本文为您仔细讲解ASP 回车 空格的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:ASP,回车,空格,下面大家一起来学习吧。

复制代码 代码如下:

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

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们