本文整理汇总了C++中wxString::SubString方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::SubString方法的具体用法?C++ wxString::SubString怎么用?C++ wxString::SubString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::SubString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseQueries
wxArrayString ParseQueries(const wxString& strQuery)
{
wxArrayString returnArray;
bool bInQuote = false;
int nLast = 0;
for ( int i=0; i<(int)strQuery.Length(); i++ )
{
if ( strQuery.SubString(i, i) == _T("'") )
bInQuote = !bInQuote;
else if ( strQuery.SubString(i, i) == _T(";") && !bInQuote )
{
wxString str;
str << strQuery.SubString(nLast, i);
if (!IsEmptyQuery(str))
returnArray.Add( str );
nLast = i + 1;
}
}
if ( nLast < (int)strQuery.Length() -1 )
{
wxString str;
str << strQuery.SubString(nLast, strQuery.Length() - 1) << _T(";");
if (!IsEmptyQuery(str))
returnArray.Add( str );
}
return returnArray;
}
示例2: if
TMotion::TMotion(const wxString& type, const wxString& length)
{
// In case of an error, default to linear growth across one second.
duration = 1000;
this->type = Linear;
if (type == "" || type == "linear")
this->type = Linear;
else if (type == "exponential")
this->type = Exponential;
else if (type == "logarthmic")
this->type = Logarithmic;
else
wxGetApp().Errorf("Unrecognized motion type '%s'.\n", type.c_str());
if (length == "") {
wxGetApp().Errorf("Motion length not specified.\n");
} else if (length.Contains("ms")) { // milliseconds
if (!length.SubString(0, length.Length() - 3).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
} else if (length.Contains("s")) { // seconds
if (!length.SubString(0, length.Length() - 2).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
else
duration *= 1000;
} else if (length.Contains("min")) { // minutes
if (!length.SubString(0, length.Length() - 4).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
else
duration *= 1000 * 60;
} else {
wxGetApp().Errorf("Motion length must be end in one of : {s, ms, min}.\n");
}
}
示例3: ProcessGroupData
void GroupWindow::ProcessGroupData( wxString text )
{
wxString outText;
int numMembers = 0;
while(1)
{
int pos = text.Find(wxChar(':'));
if( pos == wxNOT_FOUND || pos == 0 )
break;
outText = text.SubString(0, (pos-1));
ProcessGroupMember(outText); // Could crash if we didn't allocate enough lines.
text = text.SubString((pos+1), (text.Length() - 1));
numMembers++;
}
if( numMembers < 8 )
{
for( int x = numMembers; x < 8; x++ )
{
ShowMember(x, false);
}
}
Refresh();
return;
}
示例4: StringAPoli
polinomio interprete::StringAPoli(wxString poli)//Pasar a hugomat?
{
NumeroComp parteN1, parteN2;
polinomio resultado;
wxString parte1;
//Mire a ver donde esta el + o el -
int cantidad=ObtenerNumDeOperacion(poli),temporal;
int numChar=ObtenerNumCharsOperacion(poli);//FIXME!!!!!!
//Hasta ese punto seleccione
parte1=poli.SubString(0,numChar);
//Lo envie a StringAComp
parteN1=StringAComp(parte1);
resultado.CambiarFactorA(parteN1);
//Asi con todas las partes del polinomio
if(cantidad>1)
{
temporal=numChar;
int signo=1;
usi otroChar=ObtenerNumCharsOperacion(poli,poli.length());
if(poli.GetChar(numChar+1)=='-')
{
resultado.CambiarSignoB(false);
parteN2.CambiarSigno(false);
signo=0;
}
wxString parte2=poli.SubString(numChar+2,otroChar);
parteN2=StringAComp(parte2);
if(signo==0)
{
parteN2.CambiarSigno(false);
}
resultado.CambiarFactorB(parteN2);
}
return resultado;
}
示例5: TimeStringToDouble
// convert a Timestring HH:MM into a double
double CDlgAdvPreferences::TimeStringToDouble(wxString timeStr) {
double hour;
double minutes;
timeStr.SubString(0,timeStr.First(':')).ToDouble(&hour);
timeStr.SubString(timeStr.First(':')+1,timeStr.Length()).ToDouble(&minutes);
minutes = minutes/60.0;
return hour + minutes;
}
示例6: FindTab
wxString FindTab(wxString &line) {
for (int x = 0; x < line.size(); x++) {
if (line[x] == '\t') {
wxString first = line.SubString(0, x - 1);
line = line.SubString(x+1, line.size());
return first;
}
}
return line;
}
示例7: param
std::vector<wxString> tokenize(const wxString &text) {
std::vector<wxString> paramList;
paramList.reserve(6);
if (text.empty()) {
return paramList;
}
if (text[0] != '(') {
// There's just one parameter (because there's no parentheses)
// This means text is all our parameters
wxString param(text);
paramList.push_back(param.Trim(true).Trim(false));
return paramList;
}
// Ok, so there are parentheses used here, so there may be more than one parameter
// Enter fullscale parsing!
size_t i = 0, textlen = text.size();
size_t start = 0;
int parDepth = 1;
while (i < textlen && parDepth > 0) {
// Just skip until next ',' or ')', whichever comes first
// (Next ')' is achieved when parDepth == 0)
start = ++i;
while (i < textlen && parDepth > 0) {
wxChar c = text[i];
// parDepth 1 is where we start, and the tag-level we're interested in parsing on
if (c == ',' && parDepth == 1) break;
if (c == '(') parDepth++;
else if (c == ')') {
parDepth--;
if (parDepth < 0) {
wxLogWarning("Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10));
return paramList;
}
else if (parDepth == 0) {
// We just ate the parenthesis ending this parameter block
// Make sure it doesn't get included in the parameter text
break;
}
}
i++;
}
// i now points to the first character not member of this parameter
paramList.push_back(text.SubString(start, i-1).Trim(true).Trim(false));
}
if (i+1 < textlen) {
// There's some additional garbage after the parentheses
// Just add it in for completeness
paramList.push_back(text.Mid(i+1));
}
return paramList;
}
示例8: ProcessGroupMember
void GroupWindow::ProcessGroupMember( wxString text )
{
int num = 0;
int line = 0;
wxString outText;
while(1)
{
int pos = text.Find(wxChar(','));
if( pos == wxNOT_FOUND || pos == 0 || num > (MAX_GROUP - 1))
break;
outText = text.SubString(0, (pos-1));
switch( num )
{
case 0:
line = atoi(outText.ToAscii());
break;
case 1:
_txtLevel[line]->SetLabel(outText);
break;
case 2:
_txtClass[line]->SetLabel(outText);
break;
case 3:
_txtName[line]->SetLabel(outText);
ShowMember(line, true);
break;
case 4:
_hit[line] = atoi(outText.ToAscii());
break;
case 5:
_maxHit[line] = atoi(outText.ToAscii());
break;
case 6:
_mana[line] = atoi(outText.ToAscii());
break;
case 7:
_maxMana[line] = atoi(outText.ToAscii());
break;
case 8:
_move[line] = atoi(outText.ToAscii());
break;
case 9:
_maxMove[line] = atoi(outText.ToAscii());
break;
}
text = text.SubString((pos+1), (text.Length() - 1));
++num;
}
return;
}
示例9: splitStringToArray
void splitStringToArray(wxString &strLines, wxArrayString *ptArray)
{
wxString strLine;
size_t sizLineStart;
size_t sizPos;
size_t sizLen;
wxChar c;
sizPos = sizLineStart = 0;
sizLen = strLines.Len();
while( sizPos<sizLen )
{
// find next break
c = strLines.GetChar(sizPos);
++sizPos;
if( c==wxT('\n') || c== wxT('\r') )
{
// found line end
strLine = strLines.SubString(sizLineStart, sizPos);
// trim string from both sides
strLine.Trim(true);
strLine.Trim(false);
// add string to the array
if( strLine.IsEmpty()==false )
{
ptArray->Add(strLine);
wxLogMessage(wxT("romloader_openocd(") + plugin_desc.strPluginId + wxT(") : ") + strLine);
}
// new line starts after eol
sizLineStart = sizPos;
}
}
// chars left without newline?
if( sizLineStart<sizPos )
{
strLine = strLines.SubString(sizLineStart, sizPos);
// trim string from both sides
strLine.Trim(true);
strLine.Trim(false);
if( strLine.IsEmpty()==false )
{
ptArray->Add(strLine);
wxLogMessage(wxT("romloader_openocd(") + plugin_desc.strPluginId + wxT(") : ") + strLine);
}
}
}
示例10: FindStartWithDollarSubSets
wxArrayString nmeaSendObj::FindStartWithDollarSubSets(wxString FormatStr, wxString AllowdCharStr)
{ //Find pieces of text starting with'$' wich are the variables used
size_t startpos=2;
wxArrayString ReturnArray;
{
while ( (FormatStr.find( wxT("$"), startpos ) != wxNOT_FOUND) &&( startpos < FormatStr.Length() ))
{
startpos = FormatStr.find( wxT("$"), startpos );
size_t i = startpos;
while ( ( AllowdCharStr.find(FormatStr.Mid(i,1)) != (size_t)wxNOT_FOUND ) &
( i < FormatStr.Length() ) )
{
i++;
}
wxString SubString= FormatStr.SubString( startpos, i-1 );
// Check if Substring has a valid value. Should end with a digit
long test = 0;
wxString s;
SplitStringAlphaDigit(SubString, s, test);
if (( test > 0 ) && (SubString.Length() > 4))
if ( ReturnArray.Index( SubString ) == wxNOT_FOUND )
{
ReturnArray.Add( SubString );
}
startpos = i;
}
}
return ReturnArray;
}
示例11: DDNodeHasTarget
/**
* HTMLノード内(<dd>~~~</dd>)に引数の要素があるか調べる
* @param const htmlNodePtr ptr スレッドのHTML
* @param const wxString& target 抽出対象のレス番号
* @return true: あり, false: なし
*/
bool XrossBoardUtil::DDNodeHasTarget(const htmlNodePtr dd, const wxString& target)
{
for (htmlNodePtr ptr = dd->children; ptr != NULL; ptr = ptr->next)
{
if (ptr->type == XML_ELEMENT_NODE &&
xmlStrcasecmp(ptr->name, (const xmlChar*) "a") == 0)
{
xmlAttr* attribute = ptr->properties;
while(attribute && attribute->name && attribute->children)
{
xmlChar* value = xmlNodeListGetString(ptr->doc, attribute->children, 1);
//do something with value
if (xmlStrcasecmp(value, (const xmlChar*) "_blank") == 0)
{
// >>xxx (= ptr->children->content) データは実体参照ではない ">>12"
const wxString anchor = wxString::FromUTF8(reinterpret_cast<const char*>(ptr->children->content));
const wxString number = anchor.SubString(2, anchor.Len() - 1);
if (number.IsSameAs(target))
{
return true;
}
}
xmlFree(value);
attribute = attribute->next;
}
}
}
return false;
}
示例12: SetDirs
void MANFrame::SetDirs(const wxString &dirs)
{
if (!dirs.IsEmpty())
{
m_dirsVect.clear();
size_t start_pos = 4; // len("man:")
while (true)
{
size_t next_semi = dirs.find(_T(';'), start_pos);
if ((int)next_semi == wxNOT_FOUND)
{
next_semi = dirs.Length();
}
m_dirsVect.push_back(dirs.SubString(start_pos, next_semi - 1));
if (next_semi == dirs.Length())
{
break;
}
start_pos = next_semi + 1;
}
}
}
示例13: Update
void ctlDefaultPrivilegesPanel::Update(wxString strDefPrivs)
{
unsigned int index = 0;
cbGroups->Clear();
lbPrivileges->DeleteAllItems();
m_privileges.clear();
cbGroups->Append(wxT("public"));
for (; index < m_defSecurityPanel->m_groups.GetCount(); index++)
cbGroups->Append(m_defSecurityPanel->m_groups[index]);
if (!strDefPrivs.IsEmpty())
{
wxString strRole, strPriv;
strDefPrivs.Replace(wxT("\\\""), wxT("\""), true);
strDefPrivs.Replace(wxT("\\\\"), wxT("\\"), true);
// Removing starting brace '{' and ending brace '}'
strDefPrivs = strDefPrivs.SubString(1, strDefPrivs.Length() - 1);
long pos = 0;
while (pgObject::findUserPrivs(strDefPrivs, strRole, strPriv))
{
int icon;
if (strRole.IsSameAs(wxT("public"), true))
icon = PGICON_PUBLIC;
else if (cbGroups->FindString(strRole) != wxNOT_FOUND)
icon = userFactory.GetIconId();
else if (cbGroups->FindString(wxT("group ") + strRole) != wxNOT_FOUND)
{
icon = groupFactory.GetIconId();
strRole = wxT("group ") + strRole;
}
else
continue;
defPrivilege priv;
priv.m_username = strRole;
priv.m_origPriv = strPriv;
priv.m_modified = false;
priv.m_newPriv = wxT("");
wxString strKey = strRole;
m_privileges[strKey] = priv;
pos = lbPrivileges->GetItemCount();
lbPrivileges->InsertItem(pos, strRole, icon);
lbPrivileges->SetItem(pos, 1, strPriv);
strRole = wxT("");
strPriv = wxT("");
pos++;
}
}
}
示例14: FilterInput
bool SerialConnection::FilterInput( wxString &message, wxString &source )
{
if ( InputFilterList.Count() == 0 )
return true;
for ( size_t i = 0; i < InputFilterList.Count(); i++ )
if ( InputFilterList[i] == message.SubString(3,3) || InputFilterList[i] == message.SubString(1,2) || InputFilterList[i] == message.SubString(1,5) )
{
if ( InputFilterType == BLACKLIST )
return false;
else
return true;
}
if ( InputFilterType == BLACKLIST )
return true;
else
return false;
}
示例15: TrimSep
static wxString TrimSep(const wxString& path)
{
const wxString sep = wxFileName::GetPathSeparator();
if (path.EndsWith(sep)) {
return path.SubString(0, path.length()-2);
}
return path;
}