@Immutable public final class CSSURLHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_QUOTE_URLS
For compatibility reasons, this is set to false
|
| Modifier and Type | Method and Description |
|---|---|
static String |
getAsCSSURL(com.helger.commons.url.ISimpleURL aURL,
boolean bQuoteURL)
Surround the passed URL with the CSS "url(...)"
|
static String |
getAsCSSURL(String sURL,
boolean bForceQuoteURL)
Surround the passed URL with the CSS "url(...)".
|
static String |
getEscapedCSSURL(String sURL,
char cQuoteChar)
Internal method to escape a CSS URL.
|
static String |
getURLValue(String sValue)
Extract the real URL contained in a CSS URL value.
|
static boolean |
isCSSURLRequiringQuotes(String sURL)
Check if any character inside the passed URL needs escaping.
|
static boolean |
isURLValue(String sValue)
Check if the passed CSS value is an URL value.
|
static boolean |
isValidCSSURLChar(char c)
Check if the passed character is a valid character inside a URL.
|
public static final boolean DEFAULT_QUOTE_URLS
public static boolean isURLValue(@Nullable String sValue)
sValue - The value to be checked.true if the passed value starts with "url(" and ends
with ")" - false otherwise.@Nullable public static String getURLValue(@Nullable String sValue)
sValue - The value containing the CSS valuenull if the passed value is not an URL valueisURLValue(java.lang.String)@Nonnull @Nonempty public static String getAsCSSURL(@Nonnull com.helger.commons.url.ISimpleURL aURL, boolean bQuoteURL)
aURL - URL to be wrapped. May not be null.bQuoteURL - if true single quotes are added around the URLurl(sURL) or url('sURL')public static boolean isValidCSSURLChar(char c)
false must be escaped!c - The character to be checked.true if the passed character can be directly contained
inside a URL, false otherwise if the character needs
to be escaped.public static boolean isCSSURLRequiringQuotes(@Nonnull String sURL)
sURL - The URL to be checked. May not be null.true if any of the contained characters needs
escaping, false if the URL can be used as is.@Nonnull @Nonempty public static String getEscapedCSSURL(@Nonnull String sURL, char cQuoteChar)
sURL - The URL to be escaped. May not be null.cQuoteChar - The quote char that is used. Either '\'' or '"'null.@Nonnull @Nonempty public static String getAsCSSURL(@Nonnull String sURL, boolean bForceQuoteURL)
sURL - URL to be wrapped. May not be null but maybe empty.bForceQuoteURL - if true single quotes are added around the URLurl(sURL) or url('sURL')Copyright © 2014–2018 Philip Helger. All rights reserved.