当前位置:文章中心 - ASP编程 - ASP去掉字符串头尾连续回车和空格的函数
相关文章
这里放搜索
最新文章
ASP去掉字符串头尾连续回车和空格的函数
关键词:ASP,字符串,头尾,回车,空格,函数 时间:2008年09月12日 星期五 阅读:154

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

程序代码
  1. function trimVBcrlf(str)  
  2. trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))  
  3. end function 

去掉字符串开头的连续的回车和空格

程序代码
  1. function ltrimVBcrlf(str)  
  2. dim pos,isBlankChar  
  3. pos=1  
  4. isBlankChar=true  
  5. while isBlankChar  
  6. if mid(str,pos,1)=" " then  
  7. pos=pos+1  
  8. elseif mid(str,pos,2)=VBcrlf then  
  9. pos=pos+2  
  10. else  
  11. isBlankChar=false  
  12. end if  
  13. wend  
  14. ltrimVBcrlf=right(str,len(str)-pos+1)  
  15. end function 

去掉字符串末尾的连续的回车和空格

程序代码
  1. function rtrimVBcrlf(str)  
  2. dim pos,isBlankChar  
  3. pos=len(str)  
  4. isBlankChar=true  
  5. while isBlankChar and pos>=2  
  6. if mid(str,pos,1)=" " then  
  7. pos=pos-1  
  8. elseif mid(str,pos-1,2)=VBcrlf then  
  9. pos=pos-2  
  10. else  
  11. isBlankChar=false  
  12. end if  
  13. wend  
  14. rtrimVBcrlf=rtrim(left(str,pos))  
  15. end function 
上一篇:ASP加法计算题验证码下一篇:asp获取数据库中所有表名和字段名

0条记录访客评论

暂未有任何评论,你来发表一篇吧!

发表评论

(必填)
(必填)
 
友情链接