在vbscript中添加两个数字 [英] add two numbers in vbscript
本文介绍了在vbscript中添加两个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script type =" text / vbscript">
dim str1,str2
dim t1,t2
str1 =" 12.10"
str2 =" ; 10.35"
t1 = cstr(str1)
t2 = cstr(str2)
msgbox t1 + t2
< / script>
我希望它给出t1和t2(22.45)的总和,但是将它们合并
(12.1010.35)
解决方案
尝试将变量t1和t2更改为
以下t1 = cdbl(str1)
t2 = cdbl(str2)
<script type="text/vbscript">
dim str1,str2
dim t1,t2
str1="12.10"
str2="10.35"
t1=cstr(str1)
t2=cstr(str2)
msgbox t1 + t2
</script>
i want it to give sum of t1 and t2 (22.45) but concatinates them (12.1010.35)
解决方案
Try changing variables t1 and t2 to belowt1=cdbl(str1) t2=cdbl(str2)
这篇关于在vbscript中添加两个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文