Sal-laS
Sal-laS

Reputation: 11639

Error: Input string was not in correct format

To write the numbers in my motherhood language (Persian), I worked with the sting which its value is 1393 (The numbers are in Persian).

return Convert.ToInt32(Year);

But the following error appears:

Input string was not in correct format

I have tried both String and string

Upvotes: 0

Views: 142

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273179

This should work:

CultureInfo info = new CultureInfo("fa-Ir");
int x = Int32.Parse(inuptString, info);   // same as Convert.ToInt32()

Upvotes: 4

Related Questions