本文整理汇总了C++中wxString::Replace方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Replace方法的具体用法?C++ wxString::Replace怎么用?C++ wxString::Replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Replace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkBlock
wxString modeltest::checkBlock(wxString block)
{
int lsetPos, semiPos;
wxString fblock;
if(block.Contains("Lset") || block.Contains("lset") || block.Contains("LSET"))
{
int pB = wxMessageBox("LSET command found on your PAUP block.\nDo you want to comment it?", "Paup Block", wxYES | wxNO);
if(pB == wxYES)
{
lsetPos = block.Find("LSET");
block.Replace("LSET", "[LSET", false);
if(lsetPos == -1)
{
lsetPos = block.Find("Lset");
block.Replace("Lset", "[Lset", false);
}
if(lsetPos == -1)
{
lsetPos = block.Find("lset");
block.Replace("lset", "[lset", false);
}
if(lsetPos == 0)
{
semiPos = block.First(";");
block.Replace(";", ";]", false);
}
}
}
return block;
}
示例2: TranslateColorString
/// Helper function to translate the two color string representations:
/// "255 128 64" (cmap file) and "(255,128,64)" (wxPropertyGrid)
/// If wxColourObj is true, the function will create a string that can be used to create a wxColour object from it.
/// Beware: Strings that are not in one of the formats above are not caught and might result in strange return values.
static wxString TranslateColorString(wxString colorstring, bool wxColourObj=false)
{
if (colorstring.StartsWith("("))
{
// wxPropertyGrid representation.
if (wxColourObj)
{
colorstring="RGB"+colorstring;
}
else
{
colorstring.Replace("(", "");
colorstring.Replace(")", "");
colorstring.Replace(",", " ");
}
}
else
{
// cmap file representation.
colorstring.Replace(" ", ",");
colorstring="("+colorstring+")";
if (wxColourObj) colorstring="RGB"+colorstring;
}
return colorstring;
}
示例3: ParseSql
wxArrayString SQLCommandPanel::ParseSql(const wxString& sql) const
{
// filter out comments
wxString noCommentsSql;
wxArrayString lines = ::wxStringTokenize(sql, "\n", wxTOKEN_STRTOK);
for(size_t i=0; i<lines.GetCount(); ++i) {
lines.Item(i).Trim().Trim(false);
if ( lines.Item(i).StartsWith("--") ) {
continue;
}
noCommentsSql << lines.Item(i) << "\n";
}
// Split by semi-colon
wxArrayString tmpSqls = ::wxStringTokenize(noCommentsSql, ";", wxTOKEN_STRTOK);
wxArrayString sqls;
for(size_t i=0; i<tmpSqls.GetCount(); ++i) {
wxString sql = tmpSqls.Item(i);
sql.Trim().Trim(false);
if ( sql.IsEmpty() )
continue;
sql.Replace("\n", " ");
sql.Replace("\r", "");
sqls.Add( sql );
}
return sqls;
}
示例4: EscapeName
void TestClassDlg::EscapeName(wxString& name)
{
name.Replace(wxT(" "), wxEmptyString);
name.Replace(wxT("~"), wxT("Tilda"));
name.Replace(wxT("="), wxT("Shave"));
name.Replace(wxT(">"), wxT("Gadol"));
name.Replace(wxT("<"), wxT("Katan"));
}
示例5: ChangeIllegalCharacters
/*
* some characters cannot be used in filenames,
* this function change them to "_"
*/
static void ChangeIllegalCharacters( wxString& aFileName, bool aDirSepIsIllegal )
{
if( aDirSepIsIllegal )
aFileName.Replace( wxT( "/" ), wxT( "_" ) );
aFileName.Replace( wxT( " " ), wxT( "_" ) );
aFileName.Replace( wxT( ":" ), wxT( "_" ) );
}
示例6: replaceNewLine
wxString LogbookHTML::replaceNewLine(wxString s, bool mode)
{
if(mode == 0) // HTML
s.Replace(wxT("\n"),wxT("<br>"));
else // ODT
s.Replace(wxT("\n"),wxT("<text:line-break/>"));
return s;
}
示例7: encodeXMLEntities
wxString GEUIDialog::encodeXMLEntities(wxString str)
{
str.Replace(_T("<"),_T("<"));
str.Replace(_T(">"),_T(">"));
str.Replace(_T("&"),_T("&"));
str.Replace(_T("\""),_T("""));
str.Replace(_T("\\"),_T("'"));
return str;
}
示例8: TableHasColumn
// Check if, TABLE (tblname) has column with name colname
bool pgConn::TableHasColumn(wxString schemaname, wxString tblname, const wxString &colname)
{
//
// SELECT a.attname
// FROM pg_catalog.pg_attribute a
// WHERE a.attrelid = (SELECT c.oid
// FROM pg_catalog.pg_class c
// LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
// WHERE c.relname ~ '^(TABLENAME)$' AND
// pg_catalog.pg_table_is_visible(c.oid) AND
// n.nspname ~ '^(SCHEMANAME)$') AND
// a.attnum > 0 AND NOT a.attisdropped
// ORDER BY a.attnum
//
if (tblname.IsEmpty() || colname.IsEmpty())
return false;
if (schemaname.IsEmpty())
schemaname = wxT("public");
if (this && GetStatus() == PGCONN_OK)
{
tblname.Replace(wxT("\\"), wxT("\\\\"));
tblname.Replace(wxT("'"), wxT("''"));
schemaname.Replace(wxT("\\"), wxT("\\\\"));
schemaname.Replace(wxT("'"), wxT("''"));
wxString sql
= wxT("SELECT a.attname AS colname FROM pg_catalog.pg_attribute a ") \
wxT("WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.pg_class c ") \
wxT(" LEFT JOIN pg_catalog.pg_namespace n ON ") \
wxT(" n.oid = c.relnamespace ") \
wxT(" WHERE c.relname ~ '^(") + tblname + wxT(")$' AND ") \
wxT(" n.nspname ~ '^(") + schemaname + wxT(")$') AND ") \
wxT(" a.attnum > 0 AND NOT a.attisdropped ") \
wxT("ORDER BY a.attnum");
pgSet *set = ExecuteSet(sql);
if (set)
{
while (!set->Eof())
{
if (set->GetVal(wxT("colname")) == colname)
{
delete set;
return true;
}
set->MoveNext();
}
}
delete set;
}
return false;
}
示例9: SetHtmlKeywords
void SetHtmlKeywords()
{
wxString keywords = m_part->GetKeyWords();
if( keywords.empty() )
m_html.Replace( "__KEY__", wxEmptyString );
else
m_html.Replace( "__KEY__",
wxString::Format( KeywordsFormat, EscapedHTML( keywords ) ) );
}
示例10: Decimal
jewel::Decimal
wx_to_decimal
( wxString wxs,
wxLocale const& loc,
DecimalParsingFlags p_flags
)
{
bool const allow_parens =
p_flags.test(string_flags::allow_negative_parens);
wxs = wxs.Trim().Trim(false); // trim both right and left.
typedef wxChar CharT;
static CharT const open_paren = wxChar('(');
static CharT const close_paren = wxChar(')');
static CharT const minus_sign = wxChar('-');
wxString const decimal_point_s = loc.GetInfo
( wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_MONEY
);
wxString const thousands_sep_s = loc.GetInfo
( wxLOCALE_THOUSANDS_SEP,
wxLOCALE_CAT_MONEY
);
if (wxs.IsEmpty())
{
return Decimal(0, 0);
}
JEWEL_ASSERT (wxs.Len() >= 1);
if ((wxs.Len() == 1) && (*(wxs.begin()) == minus_sign))
{
return Decimal(0, 0);
}
// We first convert wxs into a canonical form in which there are no
// thousands separators, negativity is indicated only by a minus
// sign, and the decimal point is '.'.
if (allow_parens && (wxs[0] == open_paren) && (wxs.Last() == close_paren))
{
wxs[0] = minus_sign; // Replace left parenthesis with minus sign
wxs.RemoveLast(); // Drop right parenthesis
}
wxs.Replace(thousands_sep_s, wxEmptyString);
// We need to get the std::locale (not wxLocale) related decimal point
// character, so that we can ensure the Decimal constructor-from-string
// sees that appropriate decimal point character.
locale const gloc; // global locale
char const spot_char = use_facet<numpunct<char> >(gloc).decimal_point();
char const spot_str[] = { spot_char, '\0' };
wxs.Replace(decimal_point_s, wxString(spot_str));
string const s = wx_to_std8(wxs);
Decimal const ret(s);
return ret;
}
示例11: ReplaceMSVCMacros
void MSVC10Loader::ReplaceConfigMacros(const SProjectConfiguration &pc, wxString &str)
{
str.Replace(_T("$(Configuration)"),pc.sConf);
str.Replace(_T("$(Platform)"),pc.sPlatform);
str.Replace(_T("$(OutDir)"),pc.sOutDir);
str.Replace(_T("$(IntDir)"),pc.sIntDir);
str.Replace(_T("$(TargetName)"),pc.sTargetName);
str.Replace(_T("$(TargetExt)"),pc.sTargetExt);
str = ReplaceMSVCMacros(str);
}
示例12: edit_partit
wxString DescriptorFrame::edit_partit(wxString partit)
{
int erase_s=partit.Replace("<partitioning>","");
int erase_e=partit.Replace("</partitioning>","");
int erase_start=partit.find("<hostcollocation>");
while (erase_start>0)
{
erase_start=partit.find("<hostcollocation>");
int erase_end=partit.find("</hostcollocation>")+18;
if (erase_end>18)
{
partit.Remove(erase_start,erase_end-erase_start);
}
}
erase_start=0;
erase_start=partit.find("<processcollocation");
while (erase_start>0)
{
erase_start=partit.find("<processcollocation");
int erase_end=partit.find("</processcollocation>")+21;
if (erase_end>21)
{
partit.Remove(erase_start,erase_end-erase_start);
}
}
erase_start=0;
erase_start=partit.find("<homeplacement");
while (erase_start>0)
{
erase_start=1;
erase_start=partit.find("<homeplacement");
int erase_end=partit.find("</homeplacement>")+16;
if (erase_end>16)
{
partit.Remove(erase_start,erase_end-erase_start);
}
}
return partit;
}
示例13: StripString
// Removes MI additional characters from string
static void StripString(wxString &string)
{
string.Replace(wxT("\\n\""), wxT("\""));
string = string.AfterFirst(wxT('"'));
string = string.BeforeLast(wxT('"'));
string.Replace(wxT("\\\""), wxT("\""));
string.Replace(wxT("\\\\"), wxT("\\"));
string.Replace(wxT("\\\\r\\\\n"), wxT("\r\n"));
string.Replace(wxT("\\\\n"), wxT("\n"));
string.Replace(wxT("\\\\r"), wxT("\r"));
string = string.Trim();
}
示例14: SetLink
bool wxExLink::SetLink(
wxString& link,
int& line_no,
int& column_no) const
{
if (link.size() < 2)
{
return false;
}
// Using backslash as separator does not yet work.
link.Replace("\\\\", "/");
link.Replace("\\", "/");
// The harddrive letter is filtererd, it does not work
// when adding it to wxExMatch.
wxString prefix;
#ifdef __WXMSW__
if (isalpha(link[0]) && link[1] == ':')
{
prefix = link.SubString(0,1);
link = link.Mid(2);
}
#endif
// file[:line[:column]]
std::vector <wxString> v;
if (wxExMatch("([0-9A-Za-z _/.-]+):([0-9]*):?([0-9]*)", link, v))
{
link = v[0];
line_no = 0;
column_no = 0;
if (v.size() > 1)
{
line_no = atoi(v[1]);
if (v.size() > 2)
{
column_no = atoi(v[2]);
}
}
link = prefix + link;
return true;
}
return false;
}
示例15: SetHtmlAliasOf
void SetHtmlAliasOf()
{
if( m_part->IsRoot() )
{
m_html.Replace( "__ALIASOF__", wxEmptyString );
}
else
{
LIB_PART* root = m_part->GetPart();
const wxString root_name = ( root ? root->GetName() : _( "Unknown" ) );
m_html.Replace(
"__ALIASOF__", wxString::Format( AliasOfFormat, EscapedHTML( root_name ) ) );
}
}