|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.day.text.TextUtils
public class TextUtils
Simple text manipulation tasks - these aren't optimized, and are intended primarily to be used by test code. (eg. to compare returned values from functions with the values expected).
| Constructor Summary | |
|---|---|
TextUtils()
|
|
| Method Summary | |
|---|---|
static int |
countOccurences(String big,
String small)
|
static boolean |
isTextSimilar(String docOne,
String docTwo)
Compare two strings, and determine whether they are approximately "similar" - by this we mean whether they have the same numbers of each character in (barring whitespace). |
static boolean |
noisyIsTextSimilar(String docOne,
String docTwo)
|
static boolean |
occursExactlyNTimes(String big,
String small,
int n)
|
static boolean |
occursOnceOnly(String big,
String small)
|
static String |
removeControlCharacters(String characters)
|
static String |
removeWhitespace(String characters)
|
static String |
replace(String allOfTheText,
String toFind,
String toReplace)
Search and replace |
static String |
sanitizeForCommunique(String s)
These are characters not allowed in a text string in a CQ any file - they require escaping. |
protected static String |
sortString(String in)
Sort a string into alphabetical order of the characters in it. |
protected static String |
stripSortedWhitespace(String s)
Remove one block of contiguous whitespace - the behaviour will be incorrect if there is more than one block of whitespace in the string. |
String |
stripWhitespace(String s)
Remove all whitespace from a string - most useful for test purposes (where you compare two strings, but whitespace isn't syntactically significant) |
static String |
trimLastSlashLevel(String input)
Removes last level from a "slashy string" representaion of a hierarchical path. |
static String |
trimLeadingSlashes(String input)
|
static String |
trimTrailingSlashes(String input)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextUtils()
| Method Detail |
|---|
public static String removeControlCharacters(String characters)
public static String removeWhitespace(String characters)
public static boolean isTextSimilar(String docOne,
String docTwo)
This will generate false positives on some text - for example anagrams.
For example, the text "Watch the carthorse" and "Watch the orchestra" will both be converted to "aacceehhhorrstttw" and compared - so they will be identical.
This method is mostly useful as a simple way of comparing data which can be differently ordered but still functionally equivalent - for example DTDs.
public static boolean noisyIsTextSimilar(String docOne,
String docTwo)
protected static String stripSortedWhitespace(String s)
protected static String sortString(String in)
public String stripWhitespace(String s)
public static String sanitizeForCommunique(String s)
public static String replace(String allOfTheText,
String toFind,
String toReplace)
public static String trimTrailingSlashes(String input)
public static String trimLeadingSlashes(String input)
public static boolean occursOnceOnly(String big,
String small)
public static boolean occursExactlyNTimes(String big,
String small,
int n)
public static int countOccurences(String big,
String small)
public static String trimLastSlashLevel(String input)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||