文字列の先頭と末尾にある連続する改行とスペースを削除します。 文字列の先頭と末尾にある連続する改行とスペースを削除します。
関数トリムVBcrlf(str)
トリムVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))
終了関数
'文字列の先頭にある連続する改行とスペースを削除します
functionltrimVBcrlf(str)
dim pos、isBlankChar
位置=1
isBlankChar=true
while isBlankChar
if Mid(str,pos,1)= then
位置=位置+1
elseif mid(str,pos,2)=VBcrlf then
pos=pos+2
それ以外
isBlankChar=false
終了する場合
曲がります
ltrimVBcrlf=right(str,len(str)-pos+1)
終了関数
'文字列の末尾にある連続する改行とスペースを削除します
関数rtrimVBcrlf(str)
dim pos、isBlankChar
pos=長さ(文字列)
isBlankChar=true
isBlankChar かつ pos>=2 である間
if Mid(str,pos,1)= then
pos=pos-1
elseif mid(str,pos-1,2)=VBcrlf then
pos=pos-2
それ以外
isBlankChar=false
終了する場合
曲がります
rtrimVBcrlf=rtrim(left(str,pos))
終了関数