CSharp examples for System:String Strip
Removes the indicated character from the stringbuilder object
using System.Text; using System;//from w w w. j a va2 s . c o m public class Main{ /// <summary> /// Removes the indicated character from the stringbuilder object /// </summary> /// <param name="sb">StringBuilder object</param> /// <param name="value">Character to remove</param> /// <returns>Returns a new stringbuilder object</returns> public static StringBuilder Remove(this StringBuilder sb, char value) { Validation.IsNotNull(sb, "sb"); Validation.Validate(sb.Length > 0); for (var i = 0; i < sb.Length; ) { if (sb[i] == value) sb.Remove(i, 1); else i++; } return sb; } }