Class WhiteSpaceUtil
java.lang.Object
com.itextpdf.styledxmlparser.util.WhiteSpaceUtil
Utility class for white-space handling methods that are used both in pdfHTML and the iText-core SVG module
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCollapse all consecutive spaces of the passed String into single spacesstatic booleanisNonEmSpace(char ch) Checks if a character is white space value that is not em, en or similar special whitespace character.static booleanisNonLineBreakSpace(char ch) Checks if a character is white space value that doesn't cause a newline.private static Stringstatic StringprocessWhitespaces(String text, boolean keepLineBreaks, boolean collapseSpaces) Processes whitespaces according to providedkeepLineBreaksandcollapseSpacesvalues.
-
Field Details
-
EM_SPACES
-
-
Constructor Details
-
WhiteSpaceUtil
public WhiteSpaceUtil()
-
-
Method Details
-
collapseConsecutiveSpaces
-
isNonEmSpace
public static boolean isNonEmSpace(char ch) Checks if a character is white space value that is not em, en or similar special whitespace character.- Parameters:
ch- the character- Returns:
- true, if the character is a white space character, but no em, en or similar
-
isNonLineBreakSpace
public static boolean isNonLineBreakSpace(char ch) Checks if a character is white space value that doesn't cause a newline.- Parameters:
ch- the character- Returns:
true, if the character is a white space character, but no newline
-
processWhitespaces
public static String processWhitespaces(String text, boolean keepLineBreaks, boolean collapseSpaces) Processes whitespaces according to providedkeepLineBreaksandcollapseSpacesvalues.- Parameters:
text- string to processkeepLineBreaks- whether to keep line breakscollapseSpaces- whether to collapse spaces- Returns:
- processed string
-
keepLineBreaksAndSpaces
-