コード例 #1
0
        /// <summary>
        ///     Returns all characters after the last occurrence of any specified character
        /// </summary>
        public static string AfterLastAny(this string text,
                                          string separators,
                                          StringComparison comparisionType = StringComparison.OrdinalIgnoreCase,
                                          bool inclusive = false)
        {
            if (comparisionType.IsAny(
                    StringComparison.OrdinalIgnoreCase,
                    StringComparison.CurrentCultureIgnoreCase,
                    StringComparison.InvariantCultureIgnoreCase))
            {
                text       = text.ToLower();
                separators = separators.ToLower();
            }

            var i = text.LastIndexOfAny(separators.ToCharArray(), text.Length - 1);

            if (i > -1)
            {
                return(text.Substring(inclusive ? i : i + 1));
            }

            return(null);
        }