VB字符替换的问题
正在做一个文本文件转换的VB小程序,现在在做字符转换的时候,出现了一些疑问,比如我有这样的一组字符串 "+3000-4000 ",
现在我要将它转换为 "X30.00Y-40.00 "
请问哪位高手知道应该怎么做啊?
[解决办法]
dim i as integer,j as integer
dim MYString as string,Str as string,S as string,SignX as string,SignY as string
Str= "+3000-4000 " '转换为 "X30.00Y-40.00 "格式的数据
for i=1 to len(str)
S=mid(str,i,1)
if i=1 then
SignX=S
MYString=SignX
else
if IsNumeric(s) then
MYString=MYString & S
else
j=i
MYString= "X "& trim(str(val(MYString)/100)) & ":00Y "
MYString=MYString & trim(str(val(mid(str,j,len(str)-j-)/100))) & ":00 "
Exit for
end if
endif
next
debug.print MYString