Monday, 3 September 2012

How to use Replace function in C#

Replace is a very popular and useful function in VB.
Let me share how to use Replace function in C#.

public String RemoveQuote(String SQLString)
    {
        SQLString = Regex.Replace(SQLString, "'", "''");
        return SQLString;
    }

protected void cmdTest_Click(object sender, EventArgs e)
{
    me.txttest.Test =     this.txtTest2.Text.Replace("s","ss")
}