如何从文件中读取值 [英] How to read the value from a file

查看:89
本文介绍了如何从文件中读取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要从文件读取值-0000000334017并将它们存储为-3340.17在Vb.net应用程序中。我怎么能这样做?请帮忙。



谢谢。

Hi All,

I need to read the value -0000000334017 from a file and store them as -3340.17 in Vb.net application.How can i do that?Please help.

Thanks.

推荐答案





尝试编写以下函数并传递从文件中读取的文本。

Hi,

try by writing the below function and pass the text read from the file.
Private Function fnGetNumber(text As String) As Double
	Try
		Return (Convert.ToDouble(text.Trim())) / 100
	Catch ex As Exception
		Return 0.0
	End Try
End Function





此函数将为double值,如果文本是正确的,这将返回0.0并且,这将给出带有2个小数位的数字。



希望它有所帮助。



this function will the double value and if the text is in correct, this will return 0.0 and also, this will give number with 2 decimal places.

hope it helps.


这篇关于如何从文件中读取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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