在flex中显示和解析传感器数据(文本)
我是新来的。我有一个以文本文件形式发送数据的传感器。数据格式如下:dat=110405120000+000.00+000.00+005.65+000.00+040.71+000.00+000.00+000.20。
我如何解析这些数据?我想要的输出是:
日期:05-04-11 时间:12:00:00 频道01:000.00 频道02:000.00 频道03:005.65 频道04:000.00 频道05:040.71 频道06:000.00 频道07:000.00 频道08:000.20
i'm new to flex. I have a sensor that sends data as text file. Data format as follow: dat=110405120000+000.00+000.00+005.65+000.00+040.71+000.00+000.00+000.20.
How can i parse this data? The output i want is:
date: 05-04-11
time: 12:00:00
ch01: 000.00
ch02: 000.00
ch03: 005.65
ch04: 000.00
ch05: 040.71
ch06: 000.00
ch07: 000.00
ch08: 000.20
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以使用这个函数:
这是如何调用上面的函数:
这是数组结果:
访问这个数组:
但是上面的 ch01 是一个字符串,如果你需要整数值,你必须转换:
希望这可能有帮助
P.S.:
重要提示:只有当您有“ch01”到“ch09”时,上述函数才能正常工作,
如果您有“ch10”或更多,则需要对其进行修改。
you can use this function:
this is how to call the function above:
this is the array result:
to access this array:
however ch01 above is a string, if you need integer value, you have to convert:
hope this may help
P.S.:
BIG NOTE: the above function works well only if you have 'ch01' to 'ch09',
if you have 'ch10' or more, you will need to amend it.
阅读文件: http://www.openwritings.net/content/read-text -整个文件
使用 String.split() 和其他字符串函数: http:// help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html
您也可以随时向公式中添加正则表达式 (RegExp) :]
blz
read the file: http://www.openwritings.net/content/read-text-whole-file
use String.split() and other String functions: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html
You can always add regular expressions to the formula too (RegExp) :]
blz