How do you convert a string with a period character to an int?
I have to convert strings like “1924.912” to int’s, but the int.Parse() and Convert.ToInt32() methods don’t work here.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use Double.Parse() and then convert result to int.
Optionally you can specify decimal separator because its local specific.
If you want get 1924912 from “1924.912” you can achieve this by replacing “.” by “”:
Will print 1924912.