|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStringTools
public final class StringTools
Tools for reading files etc.
| Method Summary | |
|---|---|
static String |
addSpace(String word,
Language language)
Adds spaces before words that are not punctuation. |
static void |
assureSet(String s,
String varName)
Throw exception if the given string is null or empty or only whitespace. |
static String |
escapeHTML(String s)
Escapes these characters: less than, bigger than, quote, ampersand. |
static String |
escapeXML(String s)
Calls escapeHTML(String). |
static String |
getContext(int fromPos,
int toPos,
String fileContents)
|
static String |
getContext(int fromPos,
int toPos,
String fileContents,
int contextSize)
|
static String |
getLabel(String label)
Returns translation of the UI element without the control character "&". |
static char |
getMnemonic(String label)
Returns mnemonic of a UI element. |
static String |
getOOoLabel(String label)
Returns the UI element string with mnemonics encoded in OpenOffice.org convention (using "~"). |
static boolean |
isAllUppercase(String str)
Returns true if str is made up of all-uppercase characters
(ignoring characters for which no upper-/lowercase distinction exists). |
static boolean |
isWhitespace(String str)
Checks if a string contains only whitespace, including all Unicode whitespace. |
static String |
listToString(List<String> l,
String delimiter)
|
static String |
readerToString(Reader reader)
|
static String |
readFile(InputStream file)
Read a file's content. |
static String |
readFile(InputStream file,
String encoding)
Read the text file using the given encoding. |
static String |
ruleMatchesToXML(List<RuleMatch> ruleMatches,
String text,
int contextSize)
Get an XML representation of the given rule matches. |
static boolean |
startsWithUppercase(String str)
Whether the first character of str is an uppercase character. |
static String |
streamToString(InputStream is)
|
static String |
trimWhitespace(String str)
Filters any whitespace characters. |
static String |
uppercaseFirstChar(String str)
Return str modified so that its first character is now an
uppercase character. |
| Methods inherited from class Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void assureSet(String s,
String varName)
public static String readFile(InputStream file)
throws IOException
IOException
public static String readFile(InputStream file,
String encoding)
throws IOException
file - InputStream to a file to be readencoding - the file's character encoding (e.g. iso-8859-1)
\n
IOExceptionpublic static boolean isAllUppercase(String str)
str is made up of all-uppercase characters
(ignoring characters for which no upper-/lowercase distinction exists).
public static boolean startsWithUppercase(String str)
str is an uppercase character.
public static String uppercaseFirstChar(String str)
str modified so that its first character is now an
uppercase character.
public static String readerToString(Reader reader)
throws IOException
IOException
public static String streamToString(InputStream is)
throws IOException
IOExceptionpublic static String escapeXML(String s)
public static String escapeHTML(String s)
public static String ruleMatchesToXML(List<RuleMatch> ruleMatches,
String text,
int contextSize)
text - the original text that was checked, used to get the context of the matchescontextSize - the desired context size in characters
public static String listToString(List<String> l,
String delimiter)
public static String getContext(int fromPos,
int toPos,
String fileContents)
public static String getContext(int fromPos,
int toPos,
String fileContents,
int contextSize)
public static String trimWhitespace(String str)
str - String to be filtered.
public static String addSpace(String word,
Language language)
word - Word to add the space before.language - Language of the word (to check
typography conventions). Currently French
convention of not adding spaces only before '.' and
'.' is implemented; other languages assume that before
,.;:!? no spaces should be added.
public static String getLabel(String label)
label - Label to convert.
public static String getOOoLabel(String label)
label - Label to convert
public static char getMnemonic(String label)
label - String Label of the UI element
public static boolean isWhitespace(String str)
str - String to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||