Class TextHelper


  • public class TextHelper
    extends java.lang.Object
    Provides some text facilities.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] getLines​(java.lang.String string)
      Gets the lines in a text.
      static java.lang.String[] getWords​(java.lang.String string)
      Gets the words in a text.
      static java.lang.String[] wrap​(java.lang.String string, ej.microui.display.Font font, int width)
      Wraps a text in lines.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • wrap

        public static java.lang.String[] wrap​(java.lang.String string,
                                              ej.microui.display.Font font,
                                              int width)
        Wraps a text in lines.

        A new line is started:

        • after a '\n',
        • when there is no more space on the current line.
        Parameters:
        string - the text.
        font - the font used to render the text.
        width - the size of a line.
        Returns:
        the array of lines.
      • getLines

        public static java.lang.String[] getLines​(java.lang.String string)
        Gets the lines in a text.

        A new line is started after a '\n'.

        Parameters:
        string - the text to split.
        Returns:
        the array of lines.
      • getWords

        public static java.lang.String[] getWords​(java.lang.String string)
        Gets the words in a text.

        A new word is started after a space ' '.

        Parameters:
        string - the text.
        Returns:
        the array of words.