Allow either decimal separator when parsing numbers.

Fixes https://gitlab.com/kicad/code/kicad/issues/7022
This commit is contained in:
Jeff Young 2021-01-09 17:16:09 +00:00
parent ed7b3373d1
commit a42d8cecd7
1 changed files with 3 additions and 2 deletions

View File

@ -341,8 +341,9 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_
wxChar decimal_point = lc->decimal_point[0];
wxString buf( aTextValue.Strip( wxString::both ) );
// Convert the period in decimal point
// Convert any entered decimal point separators to the 'right' one
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
// Find the end of the numeric part
unsigned brk_point = 0;
@ -351,7 +352,7 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_
{
wxChar ch = buf[brk_point];
if( !( (ch >= '0' && ch <='9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
if( !( (ch >= '0' && ch <= '9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
{
break;
}