Class TextUtil
java.lang.Object
com.itextpdf.io.util.TextUtil
This file is a helper class for internal usage only.
Be aware that its API and functionality may be changed in future.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancharsetIsSupported(String charsetName) static StringcharToString(char ch) static char[]convertFromUtf32(int codePoint) Converts a UTF32 code point value to a char array with the corresponding character(s).static StringconvertFromUtf32(int[] text, int startPos, int endPos) /** Converts a UTF32 code point sequence to a String with the corresponding character(s).static char[]convertFromUtf32ToCharArray(int codePoint) Converts a UTF32 code point value to a char array with the corresponding character(s).static intconvertToUtf32(char[] text, int idx) Converts a unicode character in a character array to a UTF 32 code point value.static intconvertToUtf32(char highSurrogate, char lowSurrogate) Returns the code point of a UTF32 character corresponding with a high and a low surrogate value.static int[]convertToUtf32(String text) static intconvertToUtf32(String text, int idx) Converts a unicode character in a String to a UTF32 code point valuestatic charhighSurrogate(int codePoint) static booleanisCarriageReturnFollowedByLineFeed(GlyphLine glyphLine, int carriageReturnPosition) static booleanisDiacritic(int codePoint) Checks if the passed code point corresponds to diacritic.static booleanisLetterOrDigit(Glyph glyph) static booleanstatic booleanisNewLine(char c) Check if a character is a newline by checking if it's integer value is a newline in unicodestatic booleanisNewLine(int unicode) Check if a character is a newline by checking if it's integer value is a newline in unicodestatic booleanCheck if a glyph is a newline by checking if it's unicode value is a newlinestatic booleanisNonBreakingHyphen(Glyph glyph) static booleanisNonPrintable(int c) static booleanstatic booleanisSpaceOrWhitespace(Glyph glyph) static booleanisSurrogateHigh(char c) Check if the value of a character belongs to a certain interval that indicates it's the higher part of a surrogate pair.static booleanisSurrogateLow(char c) Check if the value of a character belongs to a certain interval that indicates it's the lower part of a surrogate pair.static booleanisSurrogatePair(char[] text, int idx) Checks if two subsequent characters in a character array are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character).static booleanisSurrogatePair(String text, int idx) Checks if two subsequent characters in a String are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character).static booleanstatic booleanisWhitespace(Glyph glyph) static booleanisWhitespaceOrNonPrintable(int code) static charlowSurrogate(int codePoint)
-
Constructor Details
-
TextUtil
private TextUtil()
-
-
Method Details
-
isDiacritic
public static boolean isDiacritic(int codePoint) Checks if the passed code point corresponds to diacritic.- Parameters:
codePoint- the code point to check- Returns:
trueif passed code point is diacritic,falseotherwise
-
isSurrogateHigh
public static boolean isSurrogateHigh(char c) Check if the value of a character belongs to a certain interval that indicates it's the higher part of a surrogate pair.- Parameters:
c- the character- Returns:
- true if the character belongs to the interval
-
isSurrogateLow
public static boolean isSurrogateLow(char c) Check if the value of a character belongs to a certain interval that indicates it's the lower part of a surrogate pair.- Parameters:
c- the character- Returns:
- true if the character belongs to the interval
-
highSurrogate
public static char highSurrogate(int codePoint) -
lowSurrogate
public static char lowSurrogate(int codePoint) -
isSurrogatePair
Checks if two subsequent characters in a String are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character).- Parameters:
text- the String with the high and low surrogate charactersidx- the index of the 'high' character in the pair- Returns:
- true if the characters are surrogate pairs
-
isSurrogatePair
public static boolean isSurrogatePair(char[] text, int idx) Checks if two subsequent characters in a character array are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character).- Parameters:
text- the character array with the high and low surrogate charactersidx- the index of the 'high' character in the pair- Returns:
- true if the characters are surrogate pairs
-
convertToUtf32
public static int convertToUtf32(char highSurrogate, char lowSurrogate) Returns the code point of a UTF32 character corresponding with a high and a low surrogate value.- Parameters:
highSurrogate- the high surrogate valuelowSurrogate- the low surrogate value- Returns:
- a code point value
-
convertToUtf32
public static int convertToUtf32(char[] text, int idx) Converts a unicode character in a character array to a UTF 32 code point value.- Parameters:
text- a character array that has the unicode character(s)idx- the index of the 'high' character- Returns:
- the code point value
-
convertToUtf32
Converts a unicode character in a String to a UTF32 code point value- Parameters:
text- a String that has the unicode character(s)idx- the index of the 'high' character- Returns:
- the codepoint value
-
convertToUtf32
-
convertFromUtf32
public static char[] convertFromUtf32(int codePoint) Converts a UTF32 code point value to a char array with the corresponding character(s).- Parameters:
codePoint- a Unicode value- Returns:
- the corresponding char array
-
convertFromUtf32
/** Converts a UTF32 code point sequence to a String with the corresponding character(s).- Parameters:
text- a Unicode text sequencestartPos- start position of text to convert, inclusiveendPos- end position of txt to convert, exclusive- Returns:
- the corresponding characters in a String
-
convertFromUtf32ToCharArray
public static char[] convertFromUtf32ToCharArray(int codePoint) Converts a UTF32 code point value to a char array with the corresponding character(s).- Parameters:
codePoint- a Unicode value- Returns:
- the corresponding characters in a char arrat
-
charToString
-
isNewLine
Check if a glyph is a newline by checking if it's unicode value is a newline- Parameters:
glyph- glyph to check- Returns:
- True if the glyph represents a newline, false otherwise
-
isNewLine
public static boolean isNewLine(char c) Check if a character is a newline by checking if it's integer value is a newline in unicode- Parameters:
c- character to check- Returns:
- True if the character represents a newline, false otherwise
-
isNewLine
public static boolean isNewLine(int unicode) Check if a character is a newline by checking if it's integer value is a newline in unicode- Parameters:
unicode- unicode value to check- Returns:
- True if the character represents a newline, false otherwise
-
isCarriageReturnFollowedByLineFeed
public static boolean isCarriageReturnFollowedByLineFeed(GlyphLine glyphLine, int carriageReturnPosition) -
isSpaceOrWhitespace
-
isWhitespace
-
isNonBreakingHyphen
-
isSpace
-
isUni0020
-
isNonPrintable
public static boolean isNonPrintable(int c) -
isWhitespaceOrNonPrintable
public static boolean isWhitespaceOrNonPrintable(int code) -
isLetterOrDigit
-
isMark
-
charsetIsSupported
-