TextUtility.NormalizeIndentation Method

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Normalizes the indentation of the specified text lines in-place.
public static void NormalizeIndentation(IList<string> lines, int tabSize = 4)

Parameters

lines IList<string>
The list of text lines to normalize.
tabSize int optional
The number of spaces to replace each tab with. Default is 4.

Exceptions

ArgumentNullException
Thrown when the lines array is null.

Remarks

This method modifies the input array in-place, performing these steps:
  1. Replaces all tabs with spaces.
  2. Removes trailing whitespace from each line.
  3. Determines the minimum indentation across all non-empty lines.
  4. Removes the minimum indentation from the beginning of each line.