/// <summary> /// Returns the right part from the first ocurrence of the given substring (without the substring). /// </summary> /// <remarks> /// Features driven by this set of rules: /// <list type="bullet"> /// <item><description>null.RightFromFirst(*) --> null</description></item> /// <item><description>null and string.Empty are always substrings of a not null string</description></item> /// /// <item><description>string.Empty only contains itself and null</description></item> /// <item><description>*.RightFromFirst(notFound) --> null</description></item> /// </list> /// </remarks> public static string RightFromFirst(this SubstrExtensionPoint sp, string substring, StringComparison comparison = StringComparison.Ordinal) { string e = sp.ExtendedValue; return(e.Safe(s => { substring = substring.EmptyIfNull(); int indexOfSubstringEnd = s.IndexOf(substring, comparison) >= 0 ? s.IndexOf(substring, comparison) + substring.Length : -1; return indexOfSubstringEnd < 0 ? null : sp.Right(s.Length - indexOfSubstringEnd); })); }