Original Post
Is there a way to convert a string which represents a float number to a float data type or should I have to write a custom function for that? I want to avoid the trouble. Thanks.
string str = "3.14159";float fnum = float.Parse(str);Quote:
Original post by mits
Is there a way to convert a string which represents a float number to a float data type or should I have to write a custom function for that? I want to avoid the trouble. Thanks.
Quote:
Original post by kSquared
You may want to use TryParse() instead, if this is .NET 2.0.
string sNum = "123";float fNum = Convert.ToSingle(sNum);Quote:
Original post by alexmoura
VB calls floats singles (or vice versa), and whoever coded Convert used that name.
Quote:
It's likely that internally the parse methods use the convert class.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more