Exemple #1
0
        /// <summary>
        ///     Remove the last indent that was added with PushIndent
        /// </summary>
        public string PopIndent()
        {
            var returnValue = "";

            if (IndentLengths.Count > 0)
            {
                var indentLength = IndentLengths[IndentLengths.Count - 1];
                IndentLengths.RemoveAt(IndentLengths.Count - 1);
                if (indentLength > 0)
                {
                    returnValue   = CurrentIndent.Substring(CurrentIndent.Length - indentLength);
                    CurrentIndent = CurrentIndent.Remove(CurrentIndent.Length - indentLength);
                }
            }
            return(returnValue);
        }
Exemple #2
0
        /// <summary>弹出缩进</summary>
        /// <returns></returns>
        public String RemoveIndent()
        {
            String str = "";

            if (indentLengths.Count > 0)
            {
                Int32 num = indentLengths[indentLengths.Count - 1];
                indentLengths.RemoveAt(indentLengths.Count - 1);
                if (num > 0)
                {
                    str           = CurrentIndent.Substring(CurrentIndent.Length - num);
                    CurrentIndent = CurrentIndent.Remove(CurrentIndent.Length - num);
                }
            }
            return(str);
        }
        /// <summary>
        /// Remove the last indent that was added with PushIndent
        /// </summary>
        /// <returns>The removed indent string</returns>
        public string PopIndent()
        {
            var str = "";

            if (indentLengths.Count > 0)
            {
                var item = indentLengths[indentLengths.Count - 1];
                indentLengths.RemoveAt(indentLengths.Count - 1);
                if (item > 0)
                {
                    str           = CurrentIndent.Substring(CurrentIndent.Length - item);
                    CurrentIndent = CurrentIndent.Remove(CurrentIndent.Length - item);
                }
            }
            return(str);
        }