/// <summary> /// Removes an indentation (3 whitespaces) from the output. /// </summary> public void UnIndent() { if (CurrentIndent.Length > 0) { CurrentIndent = CurrentIndent.Substring(0, CurrentIndent.Length - SingleIndent.Length); } }
/// <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> 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); }
/// <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); }