Class Text

java.lang.Object
com.yahoo.text.Text

public final class Text extends Object
Text utility functions.
Author:
bratseth
  • Method Details

    • isTextCharacter

      public static boolean isTextCharacter(int codepoint)
      Returns whether the given codepoint is a valid text character, potentially suitable for purposes such as indexing and display, see http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets
    • validateTextString

      public static OptionalInt validateTextString(String string)
      Validates that the given string value only contains text characters and returns the first illegal code point if one is found.
    • isValidTextString

      public static boolean isValidTextString(String string)
      Validates that the given string value only contains text characters.
    • isDisplayable

      public static boolean isDisplayable(int codePoint)
      Returns whether the given code point is displayable.
    • stripInvalidCharacters

      public static String stripInvalidCharacters(String string)
      Returns a string where any invalid characters in the input string is replaced by spaces
    • truncate

      public static String truncate(String s, int length)
      Returns a string which is never larger than the given number of characters. If the string is longer than the given length it will be truncated. If length is 4 or less the string will be truncated to length. If length is longer than 4, it will be truncated at length-4 with " ..." added at the end.
    • format

      public static String format(String format, Object... args)