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 Link icon

  • Constructor Details Link icon

  • Method Details Link icon

    • column Link icon

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

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

      public String build(String lineEnding)
    • append Link icon

      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 Link icon

      private void printSeparators(StringBuilder destination)
    • printRow Link icon

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

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

      public void clear()
    • getColumns Link icon

      public List<TextTable.Column> getColumns()