ASP去掉字符串頭尾連續(xù)回車(chē)和空格的Function
更新時(shí)間:2008年12月22日 00:45:48 作者:
去掉字符串頭尾的連續(xù)的回車(chē)和空格 去掉字符串開(kāi)頭的連續(xù)的回車(chē)和空格 去掉字符串末尾的連續(xù)的回車(chē)和空格
復(fù)制代碼 代碼如下:
'去掉字符串頭尾的連續(xù)的回車(chē)和空格
function trimVBcrlf(str)
trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))
end function
'去掉字符串開(kāi)頭的連續(xù)的回車(chē)和空格
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
'去掉字符串末尾的連續(xù)的回車(chē)和空格
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
相關(guān)文章
在ASP中用組件檢測(cè)當(dāng)前網(wǎng)卡地址的代碼
在ASP中用組件檢測(cè)當(dāng)前網(wǎng)卡地址的代碼...2007-03-03asp利用Split函數(shù)進(jìn)行多關(guān)鍵字檢索
怎樣提取數(shù)據(jù)庫(kù)用|隔開(kāi)的字!2009-09-09手寫(xiě)個(gè)小組件(組件入門(mén))asp版
下面,我們會(huì)來(lái)編寫(xiě)一個(gè)非常簡(jiǎn)單的組件,重點(diǎn)是知道怎樣開(kāi)發(fā)DLL組件,而不是其復(fù)雜的代碼!這些都要靠你們自己以后的努力了2012-08-08非常不錯(cuò)的ASP+Access數(shù)據(jù)庫(kù)的終極安全大法18則
非常不錯(cuò)的ASP+Access數(shù)據(jù)庫(kù)的終極安全大法18則...2007-06-06多域名一網(wǎng)站時(shí)如果返回最原來(lái)的域名
[紅色]多域名一網(wǎng)站時(shí)如果返回最原來(lái)的域名...2006-12-12asp 關(guān)鍵詞字符串分割如何實(shí)現(xiàn)方法
asp 關(guān)鍵詞字符串分割如何實(shí)現(xiàn)方法...2007-11-11asp正則替換鏈接實(shí)現(xiàn)偽靜態(tài)效果
有時(shí)候我們需要將頁(yè)面中的動(dòng)態(tài)頁(yè)面替換為我們偽靜態(tài)的格式,一般是頁(yè)面內(nèi)容中批量替換2013-08-08