- Home /
Answer by FlashX · Dec 02, 2014 at 02:01 AM
http://answers.unity3d.com/questions/843273/convert-this-line-from-string-to-int.html
Good luck! ;)
private int xc = System.Int32.Parse("123456789");
Try something like:
string s = "123,456.789";
float f = float.Parse(s, CultureInfo.InvariantCulture);
or http://answers.unity3d.com/questions/53730/convert-string-to-float-or-double-errors.html
Answer by robertbu · Dec 02, 2014 at 01:50 AM
You can int.TryParse(). There are many other methods, but most will raise exceptions that you likely want to write code to catch. If you don't want to deal with exceptions, int.TryParse() will do the job.
http://msdn.microsoft.com/en-us/library/system.int32.tryparse%28v=vs.110%29.aspx
Your answer
Follow this Question
Related Questions
Array - Convert Object into Int 5 Answers
Convert Array to String 3 Answers
Most efficient way to convert string[] to int [] in C#? 2 Answers
Convert Text to float 3 Answers
Why Won't This Work? 1 Answer