#include <wx/wx.h>
#include <dialog_helpers.h>
#include "pcb_calculator_frame.h"
Go to the source code of this file.
◆ DoubleFromString()
double DoubleFromString |
( |
const wxString & |
TextValue | ) |
|
Definition at line 36 of file params_read_write.cpp.
41 const struct lconv* lc = localeconv();
42 wxChar decimal_point = lc->decimal_point[0];
43 wxString buf( TextValue.Strip( wxString::both ) );
46 buf.Replace( wxT(
"." ), wxString( decimal_point, 1 ) );
49 buf.Replace( wxT(
"," ), wxString( decimal_point, 1 ) );
54 unsigned brk_point = 0;
55 while( brk_point < buf.Len() )
57 wxChar ch = buf[brk_point];
58 if( !( ( ch >=
'0' && ch <=
'9' ) || ( ch == decimal_point ) || ( ch ==
'-' )
59 || ( ch ==
'+' ) || ( ch ==
'e' ) || ( ch ==
'E' ) ) )
69 return std::nan(
"" );
73 if( !buf.Left( brk_point ).ToDouble( &value ) )
75 return std::nan(
"" );
Referenced by PCB_CALCULATOR_FRAME::OnCalculateESeries(), PCB_CALCULATOR_FRAME::OnTWCalculateFromCurrent(), PCB_CALCULATOR_FRAME::OnTWCalculateFromExtWidth(), PCB_CALCULATOR_FRAME::OnTWCalculateFromIntWidth(), PCB_CALCULATOR_FRAME::TransfPanelDataToAttenuator(), and PCB_CALCULATOR_FRAME::TWDisplayValues().