public final class TidyUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
findBadSubString(java.lang.String s,
java.lang.String p,
int len)
Return true if substring s is in p and isn't all in upper case.
|
static char |
foldCase(char c,
boolean tocaps,
boolean xmlTags)
Fold case of a char.
|
static byte[] |
getBytes(java.lang.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.
|
static java.lang.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.
|
static boolean |
isCharEncodingSupported(java.lang.String name)
Is the given character encoding supported?
|
static boolean |
isDigit(char c)
Is the given char a digit?
|
static boolean |
isLetter(char c)
Is the given char a letter?
|
static boolean |
isLower(char c)
Determines if the specified character is a lowercase character.
|
static boolean |
isNamechar(char c)
Is the given char valid in name? (letter, digit or "-", ".", ":", "_")
|
static boolean |
isUpper(char c)
Determines if the specified character is a uppercase character.
|
static boolean |
isWhite(char c)
Determines if the specified character is whitespace.
|
static int |
lastChar(java.lang.String str)
Return the last char in string.
|
static char |
toLower(char c)
Maps the given character to its lowercase equivalent.
|
static char |
toUpper(char c)
Maps the given character to its uppercase equivalent.
|
public static boolean findBadSubString(java.lang.String s, java.lang.String p, int len)
s
- substringp
- full stringlen
- how many chars to check in ppublic static byte[] getBytes(java.lang.String str)
str
- StringString.getBytes()
public static java.lang.String getString(byte[] bytes, int offset, int length)
bytes
- byte arrayoffset
- starting offset in byte arraylength
- length in byte array starting from offsetnew String(bytes, offset, length, "UTF8")
public static int lastChar(java.lang.String str)
str
- Stringpublic static boolean isWhite(char c)
c
- chartrue
if char is whitespace.public static boolean isDigit(char c)
c
- chartrue
if the given char is a digitpublic static boolean isLetter(char c)
c
- chartrue
if the given char is a letterpublic static boolean isNamechar(char c)
c
- chartrue
if char is a name char.public static boolean isLower(char c)
c
- chartrue
if char is lower case.public static boolean isUpper(char c)
c
- chartrue
if char is upper case.public static char toLower(char c)
c
- charpublic static char toUpper(char c)
c
- charpublic static char foldCase(char c, boolean tocaps, boolean xmlTags)
c
- chartocaps
- convert to capsxmlTags
- use xml tags? If true no change will be performedpublic static boolean isCharEncodingSupported(java.lang.String name)
name
- character encoding nametrue
if encoding is supported, false otherwhise.