Package com.itextpdf.io.util
Class TextUtil
- java.lang.Object
-
- com.itextpdf.io.util.TextUtil
-
public final class TextUtil extends java.lang.ObjectThis file is a helper class for internal usage only. Be aware that its API and functionality may be changed in future.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTextUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancharsetIsSupported(java.lang.String charsetName)static java.lang.StringcharToString(char ch)static char[]convertFromUtf32(int codePoint)Converts a UTF32 code point value to a char array with the corresponding character(s).static java.lang.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(java.lang.String text)static intconvertToUtf32(java.lang.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 booleanisMark(Glyph glyph)static 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 booleanisNewLine(Glyph glyph)Check if a glyph is a newline by checking if it's unicode value is a newlinestatic booleanisNonBreakingHyphen(Glyph glyph)static booleanisNonPrintable(int c)static booleanisSpace(Glyph glyph)static 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(java.lang.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 booleanisUni0020(Glyph g)static booleanisWhitespace(Glyph glyph)static booleanisWhitespaceOrNonPrintable(int code)static charlowSurrogate(int codePoint)
-
-
-
Method Detail
-
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
public static boolean isSurrogatePair(java.lang.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).- 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
public static int convertToUtf32(java.lang.String text, int idx)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
public static int[] convertToUtf32(java.lang.String text)
-
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
public static java.lang.String convertFromUtf32(int[] text, int startPos, int endPos)/** 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
public static java.lang.String charToString(char ch)
-
isNewLine
public static boolean isNewLine(Glyph glyph)
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
public static boolean isSpaceOrWhitespace(Glyph glyph)
-
isWhitespace
public static boolean isWhitespace(Glyph glyph)
-
isNonBreakingHyphen
public static boolean isNonBreakingHyphen(Glyph glyph)
-
isSpace
public static boolean isSpace(Glyph glyph)
-
isUni0020
public static boolean isUni0020(Glyph g)
-
isNonPrintable
public static boolean isNonPrintable(int c)
-
isWhitespaceOrNonPrintable
public static boolean isWhitespaceOrNonPrintable(int code)
-
isLetterOrDigit
public static boolean isLetterOrDigit(Glyph glyph)
-
isMark
public static boolean isMark(Glyph glyph)
-
charsetIsSupported
public static boolean charsetIsSupported(java.lang.String charsetName)
-
-