Package com.yahoo.text
Class Text
java.lang.Object
com.yahoo.text.Text
Text utility functions.
- Author:
- bratseth
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static boolean
isDisplayable
(int codePoint) Returns whether the given code point is displayable.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/#charsetsstatic boolean
isValidTextString
(String string) Validates that the given string value only contains text characters.static String
stripInvalidCharacters
(String string) Returns a string where any invalid characters in the input string is replaced by spacesstatic String
Returns a string which is never larger than the given number of characters.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.
-
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
Validates that the given string value only contains text characters and returns the first illegal code point if one is found. -
isValidTextString
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
Returns a string where any invalid characters in the input string is replaced by spaces -
truncate
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
-