如何在C#和VS 2010中将ascii转换为整数或双精度? [英] How do I convert from ascii to integer or double in C# and VS 2010?

查看:252
本文介绍了如何在C#和VS 2010中将ascii转换为整数或双精度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究从串口转换数据的项目。我想将它从ascii转换为整数或双精度。我试过函数

Hi, I'm working project about convert data receive from serial port. I want convert it from ascii to integer or double. I tried with function

Double.TryParse(txtkq.Text, out data_re);

用txtkq.Text是从串口接收的文本框显示数据。但它不起作用。那么谁能帮助我呢?我使用C#和visual studio 2010.

谢谢!

with txtkq.Text is textbox display data receive from serial. but it's not working. so who can help me, please? I use C# and visual studio 2010.
Thanks!

推荐答案

这应该有用。



你能提供一份文本样本吗?

使用调试器查看实际值是多少。

使用RegularExpression确保你只有你想要的部分。
That should work.

Can you provide a sample of the text?
Use the debugger to see what the actual value is.
Use a RegularExpression to ensure that you only have the parts you want.


这篇关于如何在C#和VS 2010中将ascii转换为整数或双精度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆