How to convert string to float (Single) in VB.NET

1 Answer

0 votes
Imports System
Imports System.Globalization

Public Class Program
	Public Shared Sub Main()
        Dim s As String = "647.034981"
		
        Dim f As Single = Single.Parse(s, CultureInfo.InvariantCulture.NumberFormat)
		
        Console.Write(f)
    End Sub
End Class



' run:
'
' 647.035
'

 



answered Dec 20, 2021 by avibootz

Related questions

...