感谢2群群友山城浪子提供此函数
此函数的作用在于截掉字符串头尾的空格,类似于java中的trim
function string myTrim(srcStr) //头尾都截字符串
NUMBER i;
string sRltStr1,sRltStr2,sTmpStr;
begin
//截取头部空字符
sRltStr1="";
i=0;
while (i<=StrLength(srcStr)-1)
StrSub(sTmpStr,srcStr,i,1);
if (sTmpStr!="\t"&&sTmpStr!="\r"&&sTmpStr!="\n"&&sTmpStr!=" ") then
StrSub(sRltStr1,srcStr,i,StrLength(srcStr)-i);
i=StrLength(srcStr); //Break;
endif;
i=i+1;
endwhile;
//截取尾部空字符
sRltStr2="";
i=StrLength(sRltStr1)-1;
while (i>=0)
StrSub(sTmpStr,sRltStr1,i,1);
if (sTmpStr!="\t"&&sTmpStr!="\r"&&sTmpStr!="\n"&&sTmpStr!=" ") then
StrSub(sRltStr2,sRltStr1,0,i);
i=-1;
endif;
i=i-1;
endwhile;
return sRltStr2;
end;