public final class PrepareString
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PrepareString.StringType
The type of String we have to normalize
|
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
CASE_SENSITIVE
A flag used to lowercase chars during the map process
|
private static char[][] |
COMBINING_MARKS
All the possible combining marks
|
private static boolean |
IGNORE_CASE
A flag used to keep casing during the map process
|
| Modifier | Constructor and Description |
|---|---|
private |
PrepareString()
A private constructor, to avoid instance creation of this static class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.StringBuilder |
bidi(char[] array)
Remove all bidirectionnal chars.
|
static java.lang.String |
bidi(java.lang.String str)
Remove all bidirectionnal chars.
|
private static void |
checkProhibited(char c)
Prohibit characters described in RFC 4518 :
- Table A.1 of RFC 3454
- Table C.3 of RFC 3454
- Table C.4 of RFC 3454
- Table C.5 of RFC 3454
- Table C.8 of RFC 3454
- character U-FFFD
|
private static java.lang.String |
insignifiantCharNumericString(java.lang.String str)
Remove all insignifiant spaces in a numeric string.
|
private static java.lang.String |
insignifiantCharTelephoneNumber(java.lang.String str)
Remove all insignifiant chars in a Telephone Number :
Hyphen and spaces.
|
private static java.lang.String |
insignifiantSpacesString(java.lang.String str,
boolean caseSensitive)
Remove all insignificant spaces in a string.
|
private static java.lang.String |
insignifiantSpacesStringAscii(java.lang.String str,
boolean caseSensitive)
Remove all insignificant spaces in a Ascii string.
|
private static boolean |
isCombiningMark(char c)
Tells if a char is a combining mark.
|
private static int |
map(char[] src,
char[] target,
char lowerCase)
Execute the mapping step of the string preparation :
- suppress useless chars
- transform to spaces
- lowercase
|
static java.lang.String |
normalize(java.lang.String str,
PrepareString.StringType type)
We have to go through 6 steps :
1) Transcode
2) Map
3) Normalize
4) Prohibit
5) Bidi
6) Insignifiant Character Handling
The first step is already done, the step (3) is not done.
|
private static byte |
toByte(char c) |
private static java.lang.String |
unescape(char[] array,
int end) |
private static final boolean CASE_SENSITIVE
private static final boolean IGNORE_CASE
private static final char[][] COMBINING_MARKS
private PrepareString()
private static boolean isCombiningMark(char c)
c - The char to checkpublic static java.lang.String normalize(java.lang.String str,
PrepareString.StringType type)
throws java.io.IOException
str - The String to normalizetype - The string typejava.io.IOExceptionprivate static int map(char[] src,
char[] target,
char lowerCase)
c - The char to maparray - The array which will collect the transformed charpos - The current position in the targetlowerCase - A mask to lowercase the char, if necessaryprivate static void checkProhibited(char c)
throws InvalidCharacterException
c - The char to analyzeInvalidCharacterException - If any character is prohibitedpublic static java.lang.String bidi(java.lang.String str)
str - The string where bidi chars are to be removedpublic static java.lang.StringBuilder bidi(char[] array)
array - The char array where bidi chars are to be removedprivate static java.lang.String insignifiantCharTelephoneNumber(java.lang.String str)
str - The telephone numberprivate static java.lang.String insignifiantCharNumericString(java.lang.String str)
str - The numeric Stringprivate static java.lang.String insignifiantSpacesString(java.lang.String str,
boolean caseSensitive)
throws InvalidCharacterException
str - The String to modifycaseSensitive - A flag telling if the chars must be lower casedInvalidCharacterException - If an invalid character is found in the Stringprivate static java.lang.String insignifiantSpacesStringAscii(java.lang.String str,
boolean caseSensitive)
throws InvalidCharacterException
str - The String to modifycaseSensitive - A flag telling if the chars must be lower casedInvalidCharacterException - If an invalid character is found in the Stringprivate static java.lang.String unescape(char[] array,
int end)
private static byte toByte(char c)