function replace(inputstring as string, fromchar as string, tochar as string) as string
%rem
函数功能:字符替换
输入参数:
inputstring:需要查找字符串
fromchar:被替代的字符
tochar:替代的字符
创建日志:2005-10-12 create by zhudm
%end rem
on error goto er
dim fromcharlen as integer
fromcharlen=len(fromchar)
dim goodpool as string
for x = 1 to len(inputstring)
getstring=mid(inputstring,x,fromcharlen)
if getstring=fromchar then
goodpool=goodpool & tochar
x=x + fromcharlen -1
else
goodpool=goodpool & mid(inputstring,x,1)
end if
next x
replace=goodpool
exit function
er:
msgbox error$ + +" in line "+ cstr(erl())+" of fun repace."
end function