Crosschat.StringExtensions.CutIfLonger C# (CSharp) Method

CutIfLonger() public static method

public static CutIfLonger ( this source, int maxLength = 1000 ) : string
source this
maxLength int
return string
        public static string CutIfLonger(this string source, int maxLength = 1000)
        {
            if (String.IsNullOrEmpty(source))
                return source;
            if (source.Length < maxLength)
                return source;
            return source.Remove(maxLength - 1);
        }
    }