Replaces the specified string to replace. : String Replace « Data Types « C# / C Sharp






Replaces the specified string to replace.

     
using System;
using System.Collections.Specialized;
using System.Xml;
using System.Text;
using System.Text.RegularExpressions;

namespace RSBuild
{
  /// <summary>
  /// Utility methods.
  /// </summary>
  public static class Util
  {
        /// <summary>
        /// Replaces the specified string to replace.
        /// </summary>
        /// <param name="stringToReplace">The string to replace.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        /// <returns></returns>
    public static string Replace(string stringToReplace, string oldValue, string newValue)
    {
      return Regex.Replace(stringToReplace, oldValue, newValue, RegexOptions.IgnoreCase | RegexOptions.Compiled);
    }


  }
}

   
    
    
    
    
  








Related examples in the same category

1.Replace char inside a string
2.use the Insert(), Remove(), and Replace() methods to modify strings
3.String reverse and replaceString reverse and replace
4.Inserting, replacing, and removingInserting, replacing, and removing
5.String insert and outputString insert and output
6.remove any of a set of chars from a given string.
7.Replace Once
8.Replaces the new lines in a string with the given replacement characters.