Xamarin.iOS Currency EditText format

I faced into a problem with currency formatting in C# (Xamarin iOS). I have converner which controls EditTexst's text value. but it works incorrect. for example: correct format - 11 222.33 when I try to delete decimal part it has such value - 11 222.30 - it is normal but if cursor is after decimal separator (point) and I remove it I have such result 1 122 230.00

how I can skip point and delete character up to a point? or may be you have more correct currency formatter.
var formatter = new NSNumberFormatter { NumberStyle = NSNumberFormatterStyle.Decimal, DecimalSeparator = separator, MaximumFractionDigits = 2, }; /// Пытаемся распарсить var number = formatter.NumberFromString(newStr); /// Меняем поведения форматтера formatter.GroupingSeparator = " ";

And converter which sets separators according the culture

decimal money = System.Convert.ToDecimal(value); NumberFormatInfo numberFormat = (NumberFormatInfo)culture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = " "; return money.ToString("N2", numberFormat);

Sign In or Register to comment.