AGS.Editor.DataFileWriter.SafeTruncate C# (CSharp) Méthode

SafeTruncate() private static méthode

private static SafeTruncate ( string src, int maxLength ) : string
src string
maxLength int
Résultat string
        private static string SafeTruncate(string src, int maxLength)
        {
            // TODO: I think this should actually NOT be safe and should throw an error
            // if maxLength is exceeded.
            if ((src == null) || (maxLength <= 0)) return "";
            if (maxLength >= src.Length) return src;
            return src.Substring(0, maxLength);
        }