From 8db015bc0fb32ecdd68a35654ab85deba0a2cb83 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Dec 2022 20:05:54 +0000 Subject: [PATCH] Accept thousands separators in inferred values. --- eeschema/sim/sim_model.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index d032aa823a..9106e8cbd3 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -1100,7 +1100,7 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector* aFields, if( aModelParams->IsEmpty() ) { wxRegEx idealVal( wxT( "^" - "([0-9\\. ]+)" + "([0-9\\,\\. ]+)" "([fFpPnNuUmMkKgGtTμµ𝛍𝜇𝝁 ]|M(e|E)(g|G))?" "([fFhHΩΩ𝛀𝛺𝝮rR]|ohm)?" "([-1-9 ]*)" @@ -1113,6 +1113,9 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector* aFields, wxString valueExponent( idealVal.GetMatch( value, 2 ) ); wxString valueFraction( idealVal.GetMatch( value, 6 ) ); + // Remove any thousands separators + valueMantissa.Replace( wxT( "," ), wxEmptyString ); + if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() ) { aModelParams->Printf( wxT( "%s=\"%s%s\"" ), @@ -1175,6 +1178,9 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector* aFields, wxString valueExponent( sourceVal.GetMatch( value, 2 ) ); wxString valueFraction( sourceVal.GetMatch( value, 6 ) ); + // Remove any thousands separators + valueMantissa.Replace( wxT( "," ), wxEmptyString ); + if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() ) { aModelParams->Printf( wxT( "dc=\"%s%s\"" ),