| java.lang.Object org.w3c.tidy.TidyUtils
TidyUtils | final public class TidyUtils (Code) | | Utility class with handy methods, mainly for String handling or for reproducing c behaviours.
author: Fabrizio Giustina version: $Revision $ ($Author $) |
Method Summary | |
public static boolean | findBadSubString(String s, String p, int len) Return true if substring s is in p and isn't all in upper case. | public static char | foldCase(char c, boolean tocaps, boolean xmlTags) Fold case of a char. | public static byte[] | getBytes(String str) Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding
throws declarations in lots of methods. | public static String | getString(byte[] bytes, int offset, int length) Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding
throws declarations in lots of methods. | public static boolean | isCharEncodingSupported(String name) | public static boolean | isDigit(char c) | static boolean | isInValuesIgnoreCase(String[] validValues, String valueToCheck) Check if the string valueToCheck is contained in validValues array (case insesitie comparison). | public static boolean | isLetter(char c) | public static boolean | isLower(char c) Determines if the specified character is a lowercase character. | public static boolean | isNamechar(char c) | static boolean | isQuote(int c) | public static boolean | isUpper(char c) Determines if the specified character is a uppercase character. | public static boolean | isWhite(char c) Determines if the specified character is whitespace. | static boolean | isXMLLetter(char c) | static boolean | isXMLNamechar(char c) | static boolean | isxdigit(char c) | public static int | lastChar(String str) Return the last char in string. | static boolean | toBoolean(int value) Converts a int to a boolean. | public static char | toLower(char c) Maps the given character to its lowercase equivalent. | static int | toUnsigned(int c) convert an int to unsigned (& 0xFF). | public static char | toUpper(char c) Maps the given character to its uppercase equivalent. | static int | wstrnchr(String s1, int len1, char cc) return offset of cc from beginning of s1, -1 if not found. | static boolean | wsubstr(String s1, String s2) Same as wsubstrn, but without a specified length. | static boolean | wsubstrn(String s1, int len1, String s2) check if the first String contains the second one. | static boolean | wsubstrncase(String s1, int len1, String s2) check if the first String contains the second one (ignore case). |
findBadSubString | public static boolean findBadSubString(String s, String p, int len)(Code) | | Return true if substring s is in p and isn't all in upper case. This is used to check the case of SYSTEM, PUBLIC,
DTD and EN.
Parameters: s - substring Parameters: p - full string Parameters: len - how many chars to check in p true if substring s is in p and isn't all in upper case |
foldCase | public static char foldCase(char c, boolean tocaps, boolean xmlTags)(Code) | | Fold case of a char.
Parameters: c - char Parameters: tocaps - convert to caps Parameters: xmlTags - use xml tags? If true no change will be performed folded char |
getBytes | public static byte[] getBytes(String str)(Code) | | Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding
throws declarations in lots of methods.
Parameters: str - String utf8 bytes See Also: String.getBytes |
getString | public static String getString(byte[] bytes, int offset, int length)(Code) | | Should always be able convert to/from UTF-8, so encoding exceptions are converted to an Error to avoid adding
throws declarations in lots of methods.
Parameters: bytes - byte array Parameters: offset - starting offset in byte array Parameters: length - length in byte array starting from offset same as new String(bytes, offset, length, "UTF8") |
isCharEncodingSupported | public static boolean isCharEncodingSupported(String name)(Code) | | Is the given character encoding supported?
Parameters: name - character encoding name true if encoding is supported, false otherwhise. |
isDigit | public static boolean isDigit(char c)(Code) | | Is the given char a digit?
Parameters: c - char true if the given char is a digit |
isInValuesIgnoreCase | static boolean isInValuesIgnoreCase(String[] validValues, String valueToCheck)(Code) | | Check if the string valueToCheck is contained in validValues array (case insesitie comparison).
Parameters: validValues - array of valid values Parameters: valueToCheck - value to search for true if valueToCheck is found in validValues |
isLetter | public static boolean isLetter(char c)(Code) | | Is the given char a letter?
Parameters: c - char true if the given char is a letter |
isLower | public static boolean isLower(char c)(Code) | | Determines if the specified character is a lowercase character.
Parameters: c - char true if char is lower case. |
isNamechar | public static boolean isNamechar(char c)(Code) | | Is the given char valid in name? (letter, digit or "-", ".", ":", "_")
Parameters: c - char true if char is a name char. |
isQuote | static boolean isQuote(int c)(Code) | | Is the given character a single or double quote?
Parameters: c - char true if c is " or ' |
isUpper | public static boolean isUpper(char c)(Code) | | Determines if the specified character is a uppercase character.
Parameters: c - char true if char is upper case. |
isWhite | public static boolean isWhite(char c)(Code) | | Determines if the specified character is whitespace.
Parameters: c - char true if char is whitespace. |
isXMLLetter | static boolean isXMLLetter(char c)(Code) | | Is the given char a valid xml letter?
Parameters: c - char true if the char is a valid xml letter |
isXMLNamechar | static boolean isXMLNamechar(char c)(Code) | | Is the given char valid in xml name?
Parameters: c - char true if the char is a valid xml name char |
isxdigit | static boolean isxdigit(char c)(Code) | | Is the character a hex digit?
Parameters: c - char true if he given character is a hex digit |
lastChar | public static int lastChar(String str)(Code) | | Return the last char in string. This is useful when trailing quotemark is missing on an attribute
Parameters: str - String last char in String |
toBoolean | static boolean toBoolean(int value)(Code) | | Converts a int to a boolean.
Parameters: value - int value true if value is != 0 |
toLower | public static char toLower(char c)(Code) | | Maps the given character to its lowercase equivalent.
Parameters: c - char lowercase char. |
toUnsigned | static int toUnsigned(int c)(Code) | | convert an int to unsigned (& 0xFF).
Parameters: c - signed int unsigned int |
toUpper | public static char toUpper(char c)(Code) | | Maps the given character to its uppercase equivalent.
Parameters: c - char uppercase char. |
wstrnchr | static int wstrnchr(String s1, int len1, char cc)(Code) | | return offset of cc from beginning of s1, -1 if not found.
Parameters: s1 - String Parameters: len1 - maximum offset (values > than lenl are ignored and returned as -1) Parameters: cc - character to search for index of cc in s1 |
wsubstr | static boolean wsubstr(String s1, String s2)(Code) | | Same as wsubstrn, but without a specified length.
Parameters: s1 - full String Parameters: s2 - String to search for true if s2 is found in s2 (case insensitive search) |
wsubstrn | static boolean wsubstrn(String s1, int len1, String s2)(Code) | | check if the first String contains the second one.
Parameters: s1 - full String Parameters: len1 - maximum position in String Parameters: s2 - String to search for true if s1 contains s2 in the range 0-len1 |
wsubstrncase | static boolean wsubstrncase(String s1, int len1, String s2)(Code) | | check if the first String contains the second one (ignore case).
Parameters: s1 - full String Parameters: len1 - maximum position in String Parameters: s2 - String to search for true if s1 contains s2 in the range 0-len1 |
|
|