I know, there are other questions like this e.g. Convert number into culture specific
But I am having a hard time and even the answer doesn't work for me. Still getting System.FormatException: 'Input string was not in a correct format.'
My current/system locale is de and I am parsing an en int. Whatever I tried so far (including answers from previous quesions, does not work.
So, what am I missing?
string numberStr = "1,111"; // one thousand one hundred eleven
//int result = int.Parse(numberStr);
//int result = int.Parse(numberStr, CultureInfo.GetCultureInfo("en-US").NumberFormat);
//int result = int.Parse(numberStr, CultureInfo.InvariantCulture);
//int result = int.Parse(numberStr, CultureInfo.InvariantCulture.NumberFormat);
//int result = int.Parse(numberStr, CultureInfo.GetCultureInfo("en-UK").NumberFormat);
int result = int.Parse(numberStr, CultureInfo.GetCultureInfo("en"));
Console.WriteLine(result);