public class CssUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
compareFloats(double d1,
double d2)
Helper method for comparing floating point numbers
|
static boolean |
compareFloats(float f1,
float f2)
Helper method for comparing floating point numbers
|
static double |
convertPtsToPx(double pts)
Convert given point value to a pixel value.
|
static float |
convertPtsToPx(float pts)
Convert given point value to a pixel value.
|
static double |
convertPxToPts(double px)
Convert given point value to a point value.
|
static float |
convertPxToPts(float px)
Convert given point value to a point value.
|
static String |
extractAttributeValue(String attrStr,
IElementNode element)
Parses string and return attribute value.
|
static List<List<String>> |
extractShorthandProperties(String str)
Extracts shorthand properties as list of string lists from a string, where the top level
list is shorthand property and the lower level list is properties included in shorthand property.
|
static String |
extractUnquotedString(String str)
Unquotes the passed string, e.g.
|
static String |
extractUrl(String url)
Parses
url("file.jpg") to file.jpg. |
static int |
findNextUnescapedChar(String source,
char ch,
int startIndex)
Find the next unescaped character.
|
static boolean |
isStyleSheetLink(IElementNode headChildElement)
Checks if an
IElementNode represents a style sheet link. |
static String |
normalizeCssProperty(String str)
Normalizes a CSS property.
|
static BlendMode |
parseBlendMode(String cssValue)
Parses the given css blend mode value.
|
static Range |
parseUnicodeRange(String unicodeRange)
Parses the unicode range.
|
static String |
removeDoubleSpacesAndTrim(String str)
Removes double spaces and trims a string.
|
static List<String> |
splitString(String value,
char splitChar,
EscapeGroup... escapeCharacters)
Splits the provided
String by split character with respect of escape characters. |
static List<String> |
splitStringWithComma(String value)
Splits the provided
String by comma with respect of brackets. |
public static List<String> splitStringWithComma(String value)
String by comma with respect of brackets.value - to splitList of split resultpublic static List<String> splitString(String value, char splitChar, EscapeGroup... escapeCharacters)
String by split character with respect of escape characters.value - value to splitsplitChar - character to split the StringescapeCharacters - escape charactersList of split resultpublic static BlendMode parseBlendMode(String cssValue)
null or an unknown blend
mode, then the default css BlendMode.NORMAL value would be returned.cssValue - the value to parseBlendMode instance representing the parsed valuepublic static List<List<String>> extractShorthandProperties(String str)
str - the source string with shorthand propertiespublic static String normalizeCssProperty(String str)
str - the propertypublic static String removeDoubleSpacesAndTrim(String str)
str - the stringpublic static String extractUrl(String url)
url("file.jpg") to file.jpg.url - the url attribute to parsepublic static String extractUnquotedString(String str)
"text" to text.str - the quotes stringstr if not wrapped in quotespublic static String extractAttributeValue(String attrStr, IElementNode element)
attrStr - the string contains attr() to extract attribute valueelement - the parentNode from which we extract informationpublic static int findNextUnescapedChar(String source, char ch, int startIndex)
source - a sourcech - the character to look forstartIndex - where to start lookingpublic static boolean compareFloats(double d1,
double d2)
d1 - first float to compared2 - second float to comparepublic static boolean compareFloats(float f1,
float f2)
f1 - first float to comparef2 - second float to comparepublic static Range parseUnicodeRange(String unicodeRange)
unicodeRange - the string which stores the unicode rangeRange objectpublic static float convertPtsToPx(float pts)
pts - float value to be converted to pixelspublic static double convertPtsToPx(double pts)
pts - double value to be converted to pixelspublic static float convertPxToPts(float px)
px - float value to be converted to pixelspublic static double convertPxToPts(double px)
px - double value to be converted to pixelspublic static boolean isStyleSheetLink(IElementNode headChildElement)
IElementNode represents a style sheet link.headChildElement - the head child elementCopyright © 1998–2025 Apryse Group NV. All rights reserved.