Interface TextWidthCounter

  • All Known Implementing Classes:
    ASCIITextWidthCounter, CJKTextWidthCounter

    public interface TextWidthCounter

    This interface abstracts the way of counting text width.

    Since argparse4j is command line argument parser package and it is intended to be used in terminal emulator and the terminal emulator in general uses fixed width fonts, the meaning of "width" here is given text consumes how many fixed character width. For string consisting only with ascii latin characters, it will be the same as the number of characters in given text. But for CJK characters are concerned this is not the case.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int width​(java.lang.String text)
      Counts given text consumes how many fixed character width.
    • Method Detail

      • width

        int width​(java.lang.String text)
        Counts given text consumes how many fixed character width.
        Parameters:
        text - The text to inspect.
        Returns:
        The computed value.