public class TextUtils
extends java.lang.Object
Constructor and Description |
---|
TextUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
countOccurences(java.lang.String big,
java.lang.String small) |
static boolean |
isTextSimilar(java.lang.String docOne,
java.lang.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(java.lang.String docOne,
java.lang.String docTwo) |
static boolean |
occursExactlyNTimes(java.lang.String big,
java.lang.String small,
int n) |
static boolean |
occursOnceOnly(java.lang.String big,
java.lang.String small) |
static java.lang.String |
removeControlCharacters(java.lang.String characters) |
static java.lang.String |
removeWhitespace(java.lang.String characters) |
static java.lang.String |
replace(java.lang.String allOfTheText,
java.lang.String toFind,
java.lang.String toReplace)
Search and replace
|
static java.lang.String |
sanitizeForCommunique(java.lang.String s)
These are characters not allowed in a text string in a CQ any file - they
require escaping.
|
java.lang.String |
stripWhitespace(java.lang.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 java.lang.String |
trimLastSlashLevel(java.lang.String input)
Removes last level from
a "slashy string" representaion of a
hierarchical path.
|
static java.lang.String |
trimLeadingSlashes(java.lang.String input) |
static java.lang.String |
trimTrailingSlashes(java.lang.String input) |
public static java.lang.String removeControlCharacters(java.lang.String characters)
public static java.lang.String removeWhitespace(java.lang.String characters)
public static boolean isTextSimilar(java.lang.String docOne, java.lang.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(java.lang.String docOne, java.lang.String docTwo)
public java.lang.String stripWhitespace(java.lang.String s)
public static java.lang.String sanitizeForCommunique(java.lang.String s)
public static java.lang.String replace(java.lang.String allOfTheText, java.lang.String toFind, java.lang.String toReplace)
public static java.lang.String trimTrailingSlashes(java.lang.String input)
public static java.lang.String trimLeadingSlashes(java.lang.String input)
public static boolean occursOnceOnly(java.lang.String big, java.lang.String small)
public static boolean occursExactlyNTimes(java.lang.String big, java.lang.String small, int n)
public static int countOccurences(java.lang.String big, java.lang.String small)
public static java.lang.String trimLastSlashLevel(java.lang.String input)
Copyright © 2010 - 2020 Adobe. All Rights Reserved