Package com.day.text

Class StringAbbreviator


  • public class StringAbbreviator
    extends java.lang.Object
    String abbreviator that uses a macosx-style ellipsis algorithm, where an ellipsis is added in the middle of a string instead of at the end.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_ELLIPSIS  
      static java.lang.String SPACE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String abbreviate​(java.lang.String str, int maxLength)
      Abbreviate str if needed, so that its number of characters is <= maxChars
      java.lang.String getEllipsis()  
      void setEllipsis​(java.lang.String s)
      Set our ellipsis string, to the default if s is null
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringAbbreviator

        public StringAbbreviator()
    • Method Detail

      • abbreviate

        public java.lang.String abbreviate​(java.lang.String str,
                                           int maxLength)
        Abbreviate str if needed, so that its number of characters is <= maxChars
      • setEllipsis

        public void setEllipsis​(java.lang.String s)
        Set our ellipsis string, to the default if s is null
      • getEllipsis

        public java.lang.String getEllipsis()