标题:将字符串转换为浮点数组
只看楼主
czz原来如此
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2013-8-8
结帖率:25%
已结贴  问题点数:20 回复次数:2 
将字符串转换为浮点数组
怎么将字符串:1529.004,1559.952,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000
转换为浮点型数组?

列如:dim a() as float

预期效果:a(0) = 1529.004
          a(1) = 1559.952
          .
          .
搜索更多相关主题的帖子: 字符串 
2014-03-25 18:35
lowxiong
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:27
帖 子:652
专家分:3402
注 册:2008-5-7
得分:20 
dim a() as single,b() as string,c as string,i as integer
c="1529.004,1559.952,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000"
b=split(c,",")
redim a(ubound(b))
for i=0 to ubound(b)
  a(i)=val(b(i))
next
2014-03-25 18:56
czz原来如此
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2013-8-8
得分:0 
回复 2楼 lowxiong
搞定,多谢版主
2014-03-25 19:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-429145-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.233433 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved