AngularAzureSearch.WebAPI.Helpers.Extensions.RemoveFromEnd C# (CSharp) Method

RemoveFromEnd() public static method

Handy function to remove a suffix from the end of a string (ie: Urls).
public static RemoveFromEnd ( this s, string suffix ) : string
s this
suffix string
return string
        public static string RemoveFromEnd(this string s, string suffix)
        {
            if (s.EndsWith(suffix))
            {
                return s.Substring(0, s.Length - suffix.Length);
            }
            else
            {
                return s;
            }
        }