CSharp examples for System:String Replace
Replaces the format item in a specified string with the string representation of a corresponding object in a specified array using the invariant culture.
using System.Globalization; using System;// w w w . ja v a 2s . c o m public class Main{ /// <summary> /// Replaces the format item in a specified string with the string representation of a corresponding object in a specified array using the invariant culture. /// </summary> /// <param name="format">A composite format string.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.</returns> public static string FormatInvariant(this string format, params object[] args) { return string.Format(CultureInfo.InvariantCulture, format, args); } #endregion #region Format /// <summary> /// Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. /// </summary> /// <param name="format">A composite format string.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.</returns> public static string Format(this string format, params object[] args) { return string.Format(format, args); } }