CSharp examples for System:String SubString
Return the substring after but not including the first instance of 'c'.
using System;//from w ww.j av a2 s .com public class Main{ /// <summary> /// Return the substring after but not including the first instance of 'c'. /// </summary> /// <param name="src">The source string.</param> /// <param name="c">The character to look for.</param> /// <returns>The substring after but not including the first instance of 'c'. If 'c' is not found, the entire string is returned.</returns> public static string SubstringAfter (this String src, char c) { if (String.IsNullOrEmpty(src)) return ""; int idx = Math.Min(src.Length - 1, src.IndexOf(c) + 1); if (idx < 0) return src; return src.Substring(idx); } }