Package com.itextpdf.io.util
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 boolean
charsetIsSupported
(String charsetName) static String
charToString
(char ch) static char[]
convertFromUtf32
(int codePoint) Converts a UTF32 code point value to a char array with the corresponding character(s).static String
convertFromUtf32
(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 int
convertToUtf32
(char[] text, int idx) Converts a unicode character in a character array to a UTF 32 code point value.static int
convertToUtf32
(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 int
convertToUtf32
(String text, int idx) Converts a unicode character in a String to a UTF32 code point valuestatic char
highSurrogate
(int codePoint) static boolean
isCarriageReturnFollowedByLineFeed
(GlyphLine glyphLine, int carriageReturnPosition) static boolean
isDiacritic
(int codePoint) Checks if the passed code point corresponds to diacritic.static boolean
isLetterOrDigit
(Glyph glyph) static boolean
static boolean
isNewLine
(char c) Check if a character is a newline by checking if it's integer value is a newline in unicodestatic boolean
isNewLine
(int unicode) Check if a character is a newline by checking if it's integer value is a newline in unicodestatic boolean
Check if a glyph is a newline by checking if it's unicode value is a newlinestatic boolean
isNonBreakingHyphen
(Glyph glyph) static boolean
isNonPrintable
(int c) static boolean
static boolean
isSpaceOrWhitespace
(Glyph glyph) 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.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.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).static boolean
isSurrogatePair
(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 boolean
static boolean
isWhitespace
(Glyph glyph) static boolean
isWhitespaceOrNonPrintable
(int code) static char
lowSurrogate
(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:
true
if passed code point is diacritic,false
otherwise
-
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
-