CSharp examples for System:String Contain
Returns the part of the string after the first occurrence of the given string, or null when the original text does not contain the text to find.
using System;/*from ww w . j a v a 2s .co m*/ public class Main{ /// <summary> /// Returns the part of the string after the first occurrence of the given string, /// or null when the original text does not contain the text to find. /// </summary> public static string AfterFirst(this string originalText, string textToFind) { if (String.IsNullOrEmpty(originalText) || !originalText.Contains(textToFind)) { return null; } return originalText.Substring(originalText.IndexOf(textToFind, StringComparison.Ordinal) + textToFind.Length); } }