Subtext.Framework.Format.UrlFormats.StripSurroundingSlashes C# (CSharp) Method

StripSurroundingSlashes() public static method

Strips the surrounding slashes from the specified string.
public static StripSurroundingSlashes ( string target ) : string
target string The target.
return string
        public static string StripSurroundingSlashes(string target)
        {
            if(target == null)
                throw new ArgumentNullException("target", "The target to strip slashes from is null.");

            if(target.EndsWith("/"))
                target = target.Remove(target.Length - 1, 1);
            if(target.StartsWith("/"))
                target = target.Remove(0, 1);

            return target;
        }