CssUtils { public static Range parseUnicodeRange(String unicodeRange) { String[] ranges = unicodeRange.split(","); RangeBuilder builder = new RangeBuilder(); for (String range : ranges) { if (!addRange(builder, range)) { return null; } } return builder.create(); } private  CssUtils(); static List<String> splitStringWithComma(final String value); static BlendMode parseBlendMode(String cssValue); static List<List<String>> extractShorthandProperties(String str); static String normalizeCssProperty(String str); static String removeDoubleSpacesAndTrim(String str); static Integer parseInteger(String str); static Float parseFloat(String str); static Double parseDouble(String str); static float parseAngle(String angle, String defaultMetric); static float parseAngle(String angle); static int[] parseAspectRatio(String str); static float parseAbsoluteLength(String length, String defaultMetric); static float parseAbsoluteLength(String length); static float parseRelativeValue(final String relativeValue, final float baseValue); static UnitValue parseLengthValueToPt(final String value, final float emValue, final float remValue); static boolean isValidNumericValue(final String value); static float parseAbsoluteFontSize(String fontSizeValue, String defaultMetric); static float parseAbsoluteFontSize(String fontSizeValue); static float parseRelativeFontSize(final String relativeFontSizeValue, final float baseValue); static UnitValue[] parseSpecificCornerBorderRadius(String specificBorderRadius, final float emValue, final float remValue); static float parseResolution(String resolutionStr); static int determinePositionBetweenValueAndUnit(String string); static boolean isMetricValue(final String value); static boolean isAngleValue(final String value); static boolean isRelativeValue(final String value); static boolean isFontRelativeValue(final String value); static boolean isPercentageValue(final String value); static boolean isRemValue(final String value); static boolean isEmValue(final String value); static boolean isExValue(final String value); static boolean isNumericValue(final String value); static String extractUrl(final String url); static boolean isBase64Data(String data); static int findNextUnescapedChar(String source, char ch, int startIndex); static boolean isColorProperty(String value); static boolean compareFloats(double d1, double d2); static boolean compareFloats(float f1, float f2); static float[] parseRgbaColor(String colorValue); static Range parseUnicodeRange(String unicodeRange); static float convertPtsToPx(float pts); static double convertPtsToPx(double pts); static float convertPxToPts(float px); static double convertPxToPts(double px); static boolean isStyleSheetLink(IElementNode headChildElement); static boolean isInitialOrInheritOrUnset(String value);  }
@Test public void parseUnicodeRangeTest() { Assert.assertEquals("[(0; 1048575)]", CssUtils.parseUnicodeRange("U+?????").toString()); Assert.assertEquals("[(38; 38)]", CssUtils.parseUnicodeRange("U+26").toString()); Assert.assertEquals("[(0; 127)]", CssUtils.parseUnicodeRange(" U+0-7F").toString()); Assert.assertEquals("[(37; 255)]", CssUtils.parseUnicodeRange("U+0025-00FF").toString()); Assert.assertEquals("[(1024; 1279)]", CssUtils.parseUnicodeRange("U+4??").toString()); Assert.assertEquals("[(262224; 327519)]", CssUtils.parseUnicodeRange("U+4??5?").toString()); Assert.assertEquals("[(37; 255), (1024; 1279)]", CssUtils.parseUnicodeRange("U+0025-00FF, U+4??").toString()); Assert.assertNull(CssUtils.parseUnicodeRange("U+??????")); Assert.assertNull(CssUtils.parseUnicodeRange("UU+7-10")); Assert.assertNull(CssUtils.parseUnicodeRange("U+7?-9?")); Assert.assertNull(CssUtils.parseUnicodeRange("U+7-")); }