Palak Shah
Well-known member
- Joined
- Apr 29, 2020
- Messages
- 97
- Programming Experience
- 1-3
I have one function which parses the string text to double value and it works for almost all cultures except UAE
Code
Value for UAE which has issue: "د.إ. 259.00"
Culture code: "ar-AE"
Exception Getting: System.FormatException: 'Input string was not in a correct format.'
Code
Function:
public static double Parse(string text, string culture)
{
return double.Parse(text.Replace(" ", ""), NumberStyles.AllowCurrencySymbol | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands,
new CultureInfo(culture));
}
Value for UAE which has issue: "د.إ. 259.00"
Culture code: "ar-AE"
Exception Getting: System.FormatException: 'Input string was not in a correct format.'