CSharp examples for System:String Strip
Removes if starts with.
using System.Text; using System.Linq; using System.Collections.Generic; using System;/* w w w . j a v a 2 s . c o m*/ public class Main{ /// <summary> /// Removes if starts with. /// </summary> /// <param name="source">The source.</param> /// <param name="text">The text.</param> /// <returns></returns> public static string RemoveIfStartsWith(this string source, string text) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(text)) { return source; } if (!source.StartsWith(text)) { return source; } return source.Remove(0, text.Length); } }