当前位置: 首页>>代码示例>>C++>>正文


C++ wxString::Replace方法代码示例

本文整理汇总了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;
}
开发者ID:nuin,项目名称:MrMTgui,代码行数:31,代码来源:mtgui.cpp

示例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;
}
开发者ID:mark711,项目名称:Cafu,代码行数:30,代码来源:DialogInsp-EntityProps.cpp

示例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;
}
开发者ID:HTshandou,项目名称:codelite,代码行数:29,代码来源:SqlCommandPanel.cpp

示例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"));
}
开发者ID:292388900,项目名称:codelite,代码行数:8,代码来源:testclassdlg.cpp

示例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( "_" ) );
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:12,代码来源:export_vrml.cpp

示例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;
}
开发者ID:konnibe,项目名称:Logbookkonni-0.910-for-OCPN-2.5.0,代码行数:9,代码来源:LogbookHTML.cpp

示例7: encodeXMLEntities

wxString GEUIDialog::encodeXMLEntities(wxString str)
{
      str.Replace(_T("<"),_T("&lt;"));
      str.Replace(_T(">"),_T("&gt;"));
      str.Replace(_T("&"),_T("&amp;"));
      str.Replace(_T("\""),_T("&#34;"));
      str.Replace(_T("\\"),_T("&#39;"));
      return str;
}
开发者ID:nohal,项目名称:gecomapi_pi,代码行数:9,代码来源:gecomapi.cpp

示例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;
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:57,代码来源:pgConn.cpp

示例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 ) ) );
    }
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:10,代码来源:generate_alias_info.cpp

示例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;
}
开发者ID:matt-harvey,项目名称:dailycashmanager,代码行数:54,代码来源:finformat.cpp

示例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);
}
开发者ID:stahta01,项目名称:codeblocks_sf,代码行数:11,代码来源:msvc10loader.cpp

示例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;

}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:54,代码来源:DescriptorFrame.cpp

示例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();
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:13,代码来源:debuggergdb.cpp

示例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;
}
开发者ID:hfvw,项目名称:wxExtension,代码行数:52,代码来源:link.cpp

示例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 ) ) );
     }
 }
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:14,代码来源:generate_alias_info.cpp


注:本文中的wxString::Replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。