Class StringUtilities


  • public class StringUtilities
    extends java.lang.Object
    Utility methods for building and manipulating strings.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String indent​(java.lang.String target, java.lang.String indent, int amount)
      Indents all lines of target by using indent repeated amount times.
      static java.lang.String ordinal​(int i)
      Yields the ordinal for the given integer by appending either st, nd, rd, or th to it.
      • Methods inherited from class java.lang.Object

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

      • ordinal

        public static java.lang.String ordinal​(int i)
        Yields the ordinal for the given integer by appending either st, nd, rd, or th to it.
        Parameters:
        i - the integer
        Returns:
        the ordinal string
      • indent

        public static java.lang.String indent​(java.lang.String target,
                                              java.lang.String indent,
                                              int amount)
        Indents all lines of target by using indent repeated amount times.
        Parameters:
        target - the string to indent
        indent - the string to use as indentation
        amount - the number of times indent should be repeated
        Returns:
        the indented string