| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 281 人关注过本帖
标题:将字符串转换为浮点数组
只看楼主 加入收藏
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
快速回复:将字符串转换为浮点数组
数据加载中...
 
   



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

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