Class TextTable

java.lang.Object
net.neoforged.neoforge.common.util.TextTable

public class TextTable extends Object
Utility to format data into a textual (markdown-compliant) table.
  • Field Details

  • Constructor Details

  • Method Details

    • column

      public static TextTable.Column column(String header)
    • column

      public static TextTable.Column column(String header, TextTable.Alignment alignment)
    • build

      public String build(String lineEnding)
    • append

      public void append(StringBuilder destination, String lineEnding)
      Appends the data formatted as a table to the given string builder. The padding character used for the column alignments is a single space (' '), the separate between column headers and values is a dash ('-'). Note that you *have* to specify a line ending, '\n' isn't used by default.

      The generated table is compliant with the markdown file format.

      Parameters:
      destination - a string builder to append the table to
      lineEnding - the line ending to use for each row of the table
    • printSeparators

      private void printSeparators(StringBuilder destination)
    • printRow

      private void printRow(StringBuilder destination, List<String> values)
    • add

      public void add(Object... values)
    • clear

      public void clear()
    • getColumns

      public List<TextTable.Column> getColumns()