本文整理汇总了C++中wxString::IsNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::IsNumber方法的具体用法?C++ wxString::IsNumber怎么用?C++ wxString::IsNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::IsNumber方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetNo
void wxExStyle::SetNo(const wxString& no, const wxString& macro)
{
m_No.clear();
wxStringTokenizer no_fields(no, ",");
// Collect each single no in the vector.
while (no_fields.HasMoreTokens())
{
const wxString single =
wxExLexers::Get()->ApplyMacro(no_fields.GetNextToken(), macro);
bool error = true;
if (single.IsNumber())
{
const int style_no = atoi(single.c_str());
if (style_no >= 0 && style_no <= wxSTC_STYLE_MAX)
{
m_No.insert(style_no);
error = false;
}
}
if (error)
{
wxLogError(_("Illegal style: %s"), no.c_str());
}
}
}
示例2: GetIntInfo
int Model_Infotable::GetIntInfo(const wxString& key, int default_value)
{
const wxString value = this->GetStringInfo(key, "");
if (!value.IsEmpty() && value.IsNumber())
return wxAtoi(value);
return default_value;
}
示例3: parseAndFormat
bool CPhone::parseAndFormat(const wxString& val, wxString& formattedNr)
{
initClass();
bool rc;
if (isInternalNumber(val))
{
formattedNr = val;
rc = val.IsNumber();
}
else
{
PhoneNumber phoneNr;
std::string strCC = m_Prefs->getPrefs().getCC();
std::string strAC = m_Prefs->getPrefs().getAC();
bool bAddAC = m_Prefs->getPrefs().addACIfShortLen();
int nLocalMaxLen = m_Prefs->getPrefs().getLocalNrMaxLen();
PhoneNumberUtil::ErrorType err = m_PhoneUtil->ParseAndKeepRawInput(
val.ToUTF8().data(), strCC, &phoneNr);
if (err == PhoneNumberUtil::NO_PARSING_ERROR)
{
std::string number;
if (bAddAC && !strAC.empty() && (val.Length() < nLocalMaxLen))
{
// When we have an AreaCode set in the preferences and the number
// entered is too short to contain an area code then add it and
// parse/format again.
// NOTE: Because Area Codes are ambiguous this can produce unexpected
// results or simply not work at all.
std::string nsn;
m_PhoneUtil->GetNationalSignificantNumber(phoneNr, &nsn);
number = strAC;
number += nsn;
err = m_PhoneUtil->Parse(number, strCC, &phoneNr);
if (err == PhoneNumberUtil::NO_PARSING_ERROR) {
m_PhoneUtil->Format(phoneNr, PhoneNumberUtil::INTERNATIONAL, &number);
formattedNr = wxString::FromUTF8(number.c_str());
rc = true;
} else {
formattedNr = val;
rc = false;
}
}
else {
m_PhoneUtil->Format(phoneNr, PhoneNumberUtil::INTERNATIONAL, &number);
formattedNr = wxString::FromUTF8(number.c_str());
rc = true;
}
}
else {
formattedNr = val;
rc = false;
}
}
return rc;
}
示例4: DisplaySection
bool szHelpController::DisplaySection(const wxString& section) {
int id;
if (section.IsNumber())
id = wxAtoi(section);
else
id = GetId(section);
return wxHtmlHelpControllerEx::DisplaySection(id);
}
示例5: onDelete
bool cmdListCtrl::onDelete(const wxString& item)
{
if (g_config && item.IsNumber())
{
long id;
item.ToLong(&id);
if (id >= 0 && g_config->DeleteCmd(id))
return true;
}
return false;
}
示例6: needsQuoting
static bool needsQuoting(wxString &value, bool forTypes)
{
// Is it a number?
if (value.IsNumber())
return true;
else
{
// certain types should not be quoted even though it contains a space. Evilness.
wxString valNoArray;
if (forTypes && value.Right(2) == wxT("[]"))
valNoArray = value.Mid(0, value.Len() - 2);
else
valNoArray = value;
if (forTypes &&
(!valNoArray.CmpNoCase(wxT("character varying")) ||
!valNoArray.CmpNoCase(wxT("\"char\"")) ||
!valNoArray.CmpNoCase(wxT("bit varying")) ||
!valNoArray.CmpNoCase(wxT("double precision")) ||
!valNoArray.CmpNoCase(wxT("timestamp without time zone")) ||
!valNoArray.CmpNoCase(wxT("timestamp with time zone")) ||
!valNoArray.CmpNoCase(wxT("time without time zone")) ||
!valNoArray.CmpNoCase(wxT("time with time zone")) ||
!valNoArray.CmpNoCase(wxT("\"trigger\"")) ||
!valNoArray.CmpNoCase(wxT("\"unknown\""))))
return false;
int pos = 0;
while (pos < (int)valNoArray.length())
{
wxChar c = valNoArray.GetChar(pos);
if (!((pos > 0) && (c >= '0' && c <= '9')) &&
!(c >= 'a' && c <= 'z') &&
!(c == '_'))
{
return true;
}
pos++;
}
}
// is it a keyword?
const ScanKeyword *sk = ScanKeywordLookup(value.ToAscii());
if (!sk)
return false;
if (sk->category == UNRESERVED_KEYWORD)
return false;
if (forTypes && sk->category == COL_NAME_KEYWORD)
return false;
return true;
}
示例7: GetSection
int GetSection(wxString& s)
{
int i, f;
long r = -1;
i = s.First('[');
f = s.Last(']');
if (f > i)
{
s = s.Mid((i + 1), (f - i - 1));
if (s.IsNumber())
s.ToLong(&r);
else
r = -1;
}
return ((int) r);
}
示例8: if
bool interprete::interprete1(wxString linea)
{
lenguajea2();
bool si=false;
int tempo=0,tempo2=0;
polinomio respuestaAn;
archivoDatos=fopen("TempInterprete.hs","w");
archivoDebug=fopen("TempDebug.hs","w");
fprintf(archivoDebug,L_Ev_Ope);
if(linea.GetChar(0)=='+'||linea.GetChar(0)=='*')
{
return SINTAXIS_PRIMER;
}
if(linea.GetChar(0)=='/'||linea.GetChar(0)=='-'||linea.GetChar(0)=='?')
{
return SINTAXIS_PRIMER;
}
wxString subCadena,subCadena2;
if(linea.IsNumber())
{
fprintf(archivoDebug,L_S_o);
polinomio temp1[3],temp2;
usi i=0,nums=0, nums2=0, nums3=0;
subCadena=linea;
nums=ObtenerNumDeOperacion(subCadena);
nums2=ObtenerNumCharsOperacion(subCadena);
for(i=0;i<nums;i++)
{
nums3=ObtenerNumCharsOperacion(subCadena,nums);
temp1[i]=StringAPoli(subCadena);
}
si=true;
}
subCadena=linea.Mid(0,1);
if(subCadena=='{')
{
fprintf(archivoDebug,L_S_o);
pol=StringAPoli(linea.Mid(1,linea.length()));
polinomio pm;
if(linea.Find('+')!=-1)
{
pm=pol.simplificar();
}
else if(linea.Find('-')!=-1)
{
pm=pol.simplificar();
}
else if(linea.Find('*')!=-1)
{
pm=pol.multiplicar();
}
//polinomio pm=pol.simplificar();
wxString a=PoliAString(pm);
fprintf(archivoDebug,a);
si=true;
}
if(subCadena=="e"&&linea.GetChar(1)!='x')
{
factores=EXPONENCI;
fprintf(archivoDebug,L_S_oe);
subCadena2=linea.Mid(1,linea.length()-2);
wxString exponTemp=ObtenerPolinomioParen(subCadena2);
if(exponTemp=="error")
{
fprintf(archivoDebug,L_NoArg);
si=false;
}
else
{
if(exponTemp.Contains('+')||exponTemp.Contains('-'))
{
fprintf(archivoDebug,L_Poli_De);
fprintf(archivoDebug,"Interprete: Transformando de texto a polinomio\n");
pol=StringAPoli(exponTemp);
fprintf(archivoDebug,"Interprete: Transformando de polinomio a numero compuesto\n");
com=PoliAComp(pol);
fprintf(archivoDebug,"Interprete: Transformando de numero compuesto a numero real\n");
rea=CompAReal(com);
}
else
{
fprintf(archivoDebug,"Interprete: Detectado Numero real o compuesto\n");
fprintf(archivoDebug,"Interprete: haciendo tareas pertinentes\n");
if(exponTemp.Contains('x')||exponTemp.Contains('y')||exponTemp.Contains('z'))
{
com=StringAComp(exponTemp);
}
else
{
rea=CompAReal(com);
double dou=UtilitariosBasicos::NumeroRealADouble(rea);
archivoRes=fopen("TempInterpreteRes.hs","w");
fprintf(archivoRes,"%f",exp(dou));
fclose(archivoRes);
}
}
si=true;
}
}
subCadena=linea.Mid(0,2);
//.........这里部分代码省略.........