public final class PrepareString extends 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 StringBuilder |
bidi(char[] array)
Remove all bidirectionnal chars.
|
static String |
bidi(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 String |
insignifiantCharNumericString(String str)
Remove all insignifiant spaces in a numeric string.
|
private static String |
insignifiantCharTelephoneNumber(String str)
Remove all insignifiant chars in a Telephone Number :
Hyphen and spaces.
|
private static String |
insignifiantSpacesString(String str,
boolean caseSensitive)
Remove all insignificant spaces in a string.
|
private static String |
insignifiantSpacesStringAscii(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 String |
normalize(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 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 String normalize(String str, PrepareString.StringType type) throws IOException
str - The String to normalizetype - The string typeIOException - If teh normalization failedprivate 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 org.apache.directory.api.util.exception.InvalidCharacterException
c - The char to analyzeorg.apache.directory.api.util.exception.InvalidCharacterException - If any character is prohibitedpublic static String bidi(String str)
str - The string where bidi chars are to be removedpublic static StringBuilder bidi(char[] array)
array - The char array where bidi chars are to be removedprivate static String insignifiantCharTelephoneNumber(String str)
str - The telephone numberprivate static String insignifiantCharNumericString(String str)
str - The numeric Stringprivate static String insignifiantSpacesString(String str, boolean caseSensitive) throws org.apache.directory.api.util.exception.InvalidCharacterException
str - The String to modifycaseSensitive - A flag telling if the chars must be lower casedorg.apache.directory.api.util.exception.InvalidCharacterException - If an invalid character is found in the Stringprivate static String insignifiantSpacesStringAscii(String str, boolean caseSensitive) throws org.apache.directory.api.util.exception.InvalidCharacterException
str - The String to modifycaseSensitive - A flag telling if the chars must be lower casedorg.apache.directory.api.util.exception.InvalidCharacterException - If an invalid character is found in the Stringprivate static String unescape(char[] array, int end)
private static byte toByte(char c)
Copyright © 2003–2017 The Apache Software Foundation. All rights reserved.