public final class Normalizer extends Object implements Cloneable
This API has been replaced by the Normalizer2
class and is only available
for backward compatibility. This class simply delegates to the Normalizer2 class.
There are two exceptions: The new API does not provide a replacement for
QuickCheckResult
and compare()
.
normalize
transforms Unicode text into an equivalent composed or
decomposed form, allowing for easier sorting and searching of text.
normalize
supports the standard normalization forms described in
Unicode Standard Annex #15 — Unicode Normalization Forms.
Characters with accents or other adornments can be encoded in several different ways in Unicode. For example, take the character A-acute. In Unicode, this can be encoded as a single character (the "composed" form):
00C1 LATIN CAPITAL LETTER A WITH ACUTEor as two separate characters (the "decomposed" form):
0041 LATIN CAPITAL LETTER A 0301 COMBINING ACUTE ACCENT
To a user of your program, however, both of these sequences should be treated as the same "user-level" character "A with acute accent". When you are searching or comparing text, you must ensure that these two sequences are treated equivalently. In addition, you must handle characters with more than one accent. Sometimes the order of a character's combining accents is significant, while in other cases accent sequences in different orders are really equivalent.
Similarly, the string "ffi" can be encoded as three separate letters:
0066 LATIN SMALL LETTER F 0066 LATIN SMALL LETTER F 0069 LATIN SMALL LETTER Ior as the single character
FB03 LATIN SMALL LIGATURE FFI
The ffi ligature is not a distinct semantic character, and strictly speaking it shouldn't be in Unicode at all, but it was included for compatibility with existing character sets that already provided it. The Unicode standard identifies such characters by giving them "compatibility" decompositions into the corresponding semantic characters. When sorting and searching, you will often want to use these mappings.
normalize
helps solve these problems by transforming text into
the canonical composed and decomposed forms as shown in the first example
above. In addition, you can have it perform compatibility decompositions so
that you can treat compatibility characters the same as their equivalents.
Finally, normalize
rearranges accents into the proper canonical
order, so that you do not have to worry about accent rearrangement on your
own.
Form FCD, "Fast C or D", is also designed for collation. It allows to work on strings that are not necessarily normalized with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed characters and their decomposed equivalents the same.
It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical themselves.
The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character, results in a string that is canonically ordered. This means that precomposed characters are allowed for as long as their decompositions do not need canonical reordering.
Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts - already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will return YES for most strings in practice.
normalize(FCD) may be implemented with NFD.
For more details on FCD see Unicode Technical Note #5 (Canonical Equivalence in Applications): http://www.unicode.org/notes/tn5/#FCD
ICU collation performs either NFD or FCD normalization automatically if normalization is turned on for the collator object. Beyond collation and string search, normalized strings may be useful for string equivalence comparisons, transliteration/transcription, unique representations, etc.
The W3C generally recommends to exchange texts in NFC. Note also that most legacy character encodings use only precomposed forms and often do not encode any combining marks by themselves. For conversion to such character encodings the Unicode text needs to be normalized to NFC. For more usage examples, see the Unicode Standard Annex.
Note: The Normalizer class also provides API for iterative normalization. While the setIndex() and getIndex() refer to indices in the underlying Unicode input text, the next() and previous() methods iterate through characters in the normalized output. This means that there is not necessarily a one-to-one correspondence between characters returned by next() and previous() and the indices passed to and returned from setIndex() and getIndex(). It is for this reason that Normalizer does not implement the CharacterIterator interface.
Modifier and Type | Class and Description |
---|---|
static class |
Normalizer.Mode
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static class |
Normalizer.QuickCheckResult
Result values for quickCheck().
|
Modifier and Type | Field and Description |
---|---|
static int |
COMPARE_CODE_POINT_ORDER
Option bit for compare:
Compare strings in code point order instead of code unit order.
|
static int |
COMPARE_IGNORE_CASE
Option bit for compare:
Perform case-insensitive comparison.
|
static int |
COMPARE_NORM_OPTIONS_SHIFT
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.Mode |
COMPOSE
Deprecated.
ICU 2.8. Use Normalier.NFC
|
static Normalizer.Mode |
COMPOSE_COMPAT
Deprecated.
ICU 2.8. Use Normalizer.NFKC
|
static Normalizer.Mode |
DECOMP
Deprecated.
ICU 2.8. Use Normalizer.NFD
|
static Normalizer.Mode |
DECOMP_COMPAT
Deprecated.
ICU 2.8. Use Normalizer.NFKD
|
static Normalizer.Mode |
DEFAULT
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
DONE
Deprecated.
ICU 56
|
static Normalizer.Mode |
FCD
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
FOLD_CASE_DEFAULT
Option bit for compare:
Case sensitively compare the strings
|
static int |
FOLD_CASE_EXCLUDE_SPECIAL_I
Option value for case folding:
Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
and dotless i appropriately for Turkic languages (tr, az).
|
static int |
IGNORE_HANGUL
Deprecated.
ICU 2.8. This option is no longer supported.
|
static int |
INPUT_IS_FCD
Option bit for compare:
Both input strings are assumed to fulfill FCD conditions.
|
static Normalizer.QuickCheckResult |
MAYBE
Indicates it cannot be determined if string is in the normalized
format without further thorough checks.
|
static Normalizer.Mode |
NFC
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.Mode |
NFD
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.Mode |
NFKC
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.Mode |
NFKD
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.QuickCheckResult |
NO
Indicates that string is not in the normalized format
|
static Normalizer.Mode |
NO_OP
Deprecated.
ICU 2.8. Use Nomalizer.NONE
|
static Normalizer.Mode |
NONE
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
UNICODE_3_2
Deprecated.
ICU 56 Use
FilteredNormalizer2 instead. |
static Normalizer.QuickCheckResult |
YES
Indicates that string is in the normalized format
|
Constructor and Description |
---|
Normalizer(CharacterIterator iter,
Normalizer.Mode mode,
int opt)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
Normalizer(String str,
Normalizer.Mode mode,
int opt)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
Normalizer(UCharacterIterator iter,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
compare(char[] s1,
char[] s2,
int options)
Compare two strings for canonical equivalence.
|
static int |
compare(char[] s1,
int s1Start,
int s1Limit,
char[] s2,
int s2Start,
int s2Limit,
int options)
Compare two strings for canonical equivalence.
|
static int |
compare(int char32a,
int char32b,
int options)
Convenience method that can have faster implementation
by not allocating buffers.
|
static int |
compare(int char32a,
String str2,
int options)
Convenience method that can have faster implementation
by not allocating buffers.
|
static int |
compare(String s1,
String s2,
int options)
Compare two strings for canonical equivalence.
|
static int |
compose(char[] source,
char[] target,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
compose(char[] src,
int srcStart,
int srcLimit,
char[] dest,
int destStart,
int destLimit,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
compose(String str,
boolean compat)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
compose(String str,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
concatenate(char[] left,
char[] right,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
concatenate(char[] left,
int leftStart,
int leftLimit,
char[] right,
int rightStart,
int rightLimit,
char[] dest,
int destStart,
int destLimit,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
concatenate(String left,
String right,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
int |
current()
Deprecated.
ICU 56
|
static int |
decompose(char[] source,
char[] target,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
decompose(char[] src,
int srcStart,
int srcLimit,
char[] dest,
int destStart,
int destLimit,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
decompose(String str,
boolean compat)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
decompose(String str,
boolean compat,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
int |
endIndex()
Deprecated.
ICU 56
|
int |
first()
Deprecated.
ICU 56
|
int |
getBeginIndex()
Deprecated.
ICU 2.2. Use startIndex() instead.
|
int |
getEndIndex()
Deprecated.
ICU 2.2. Use endIndex() instead.
|
static String |
getFC_NFKC_Closure(int c)
Deprecated.
ICU 56
|
static int |
getFC_NFKC_Closure(int c,
char[] dest)
Deprecated.
ICU 56
|
int |
getIndex()
Deprecated.
ICU 56
|
int |
getLength()
Deprecated.
ICU 56
|
Normalizer.Mode |
getMode()
Deprecated.
ICU 56
|
int |
getOption(int option)
Deprecated.
ICU 56
|
String |
getText()
Deprecated.
ICU 56
|
int |
getText(char[] fillIn)
Deprecated.
ICU 56
|
static boolean |
isNormalized(char[] src,
int start,
int limit,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static boolean |
isNormalized(int char32,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static boolean |
isNormalized(String str,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
int |
last()
Deprecated.
ICU 56
|
int |
next()
Deprecated.
ICU 56
|
static int |
normalize(char[] source,
char[] target,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static int |
normalize(char[] src,
int srcStart,
int srcLimit,
char[] dest,
int destStart,
int destLimit,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
normalize(int char32,
Normalizer.Mode mode)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
normalize(int char32,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
normalize(String src,
Normalizer.Mode mode)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static String |
normalize(String str,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
int |
previous()
Deprecated.
ICU 56
|
static Normalizer.QuickCheckResult |
quickCheck(char[] source,
int start,
int limit,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.QuickCheckResult |
quickCheck(char[] source,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.QuickCheckResult |
quickCheck(String source,
Normalizer.Mode mode)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
static Normalizer.QuickCheckResult |
quickCheck(String source,
Normalizer.Mode mode,
int options)
Deprecated.
ICU 56 Use
Normalizer2 instead. |
void |
reset()
Deprecated.
ICU 56
|
int |
setIndex(int index)
Deprecated.
ICU 3.2
|
void |
setIndexOnly(int index)
Deprecated.
ICU 56
|
void |
setMode(Normalizer.Mode newMode)
Deprecated.
ICU 56
|
void |
setOption(int option,
boolean value)
Deprecated.
ICU 56
|
void |
setText(char[] newText)
Deprecated.
ICU 56
|
void |
setText(CharacterIterator newText)
Deprecated.
ICU 56
|
void |
setText(String newText)
Deprecated.
ICU 56
|
void |
setText(StringBuffer newText)
Deprecated.
ICU 56
|
void |
setText(UCharacterIterator newText)
Deprecated.
ICU 56
|
int |
startIndex()
Deprecated.
ICU 56
|
@Deprecated public static final int UNICODE_3_2
FilteredNormalizer2
instead.@Deprecated public static final int DONE
UForwardCharacterIterator.DONE
.@Deprecated public static final Normalizer.Mode NONE
Normalizer2
instead.@Deprecated public static final Normalizer.Mode NFD
Normalizer2
instead.@Deprecated public static final Normalizer.Mode NFKD
Normalizer2
instead.@Deprecated public static final Normalizer.Mode NFC
Normalizer2
instead.@Deprecated public static final Normalizer.Mode DEFAULT
Normalizer2
instead.@Deprecated public static final Normalizer.Mode NFKC
Normalizer2
instead.@Deprecated public static final Normalizer.Mode FCD
Normalizer2
instead.@Deprecated public static final Normalizer.Mode NO_OP
constructors
and the static normalize
method. This value tells
the Normalizer to do nothing but return unprocessed characters
from the underlying String or CharacterIterator. If you have code which
requires raw text at some times and normalized text at others, you can
use NO_OP for the cases where you want raw text, rather
than having a separate code path that bypasses Normalizer
altogether.
setMode(com.ibm.icu.text.Normalizer.Mode)
,
NONE
@Deprecated public static final Normalizer.Mode COMPOSE
constructors
and the static
normalize
method to determine the operation to be
performed.
If all optional features (e.g. IGNORE_HANGUL
) are turned
off, this operation produces output that is in
Unicode Canonical
Form
C.
setMode(com.ibm.icu.text.Normalizer.Mode)
,
NFC
@Deprecated public static final Normalizer.Mode COMPOSE_COMPAT
constructors
and the static
normalize
method to determine the operation to be
performed.
If all optional features (e.g. IGNORE_HANGUL
) are turned
off, this operation produces output that is in
Unicode Canonical
Form
KC.
setMode(com.ibm.icu.text.Normalizer.Mode)
,
NFKC
@Deprecated public static final Normalizer.Mode DECOMP
constructors
and the static
normalize
method to determine the operation to be performed.
If all optional features (e.g. IGNORE_HANGUL
) are turned
off, this operation produces output that is in
Unicode Canonical
Form
D.
setMode(com.ibm.icu.text.Normalizer.Mode)
,
NFD
@Deprecated public static final Normalizer.Mode DECOMP_COMPAT
constructors
and the static
normalize
method to determine the operation to be performed.
If all optional features (e.g. IGNORE_HANGUL
) are turned
off, this operation produces output that is in
Unicode Canonical
Form
KD.
setMode(com.ibm.icu.text.Normalizer.Mode)
,
NFKD
@Deprecated public static final int IGNORE_HANGUL
The Unicode standard treats Hangul to Jamo conversion as a canonical decomposition, so this option must be turned off if you wish to transform strings into one of the standard Unicode Normalization Forms.
setOption(int, boolean)
,
Constant Field Valuespublic static final Normalizer.QuickCheckResult NO
public static final Normalizer.QuickCheckResult YES
public static final Normalizer.QuickCheckResult MAYBE
public static final int FOLD_CASE_DEFAULT
public static final int INPUT_IS_FCD
public static final int COMPARE_IGNORE_CASE
public static final int COMPARE_CODE_POINT_ORDER
public static final int FOLD_CASE_EXCLUDE_SPECIAL_I
UCharacter.FOLD_CASE_EXCLUDE_SPECIAL_I
,
Constant Field Values@Deprecated public static final int COMPARE_NORM_OPTIONS_SHIFT
Normalizer2
instead.@Deprecated public Normalizer(String str, Normalizer.Mode mode, int opt)
Normalizer2
instead.The options parameter specifies which optional Normalizer features are to be enabled for this object.
str
- The string to be normalized. The normalization
will start at the beginning of the string.mode
- The normalization mode.opt
- Any optional features to be enabled.
Currently the only available option is UNICODE_3_2
.
If you want the default behavior corresponding to one of the
standard Unicode Normalization Forms, use 0 for this argument.@Deprecated public Normalizer(CharacterIterator iter, Normalizer.Mode mode, int opt)
Normalizer2
instead.iter
- The input text to be normalized. The normalization
will start at the beginning of the string.mode
- The normalization mode.opt
- Any optional features to be enabled.
Currently the only available option is UNICODE_3_2
.
If you want the default behavior corresponding to one of the
standard Unicode Normalization Forms, use 0 for this argument.@Deprecated public Normalizer(UCharacterIterator iter, Normalizer.Mode mode, int options)
Normalizer2
instead.iter
- The input text to be normalized. The normalization
will start at the beginning of the string.mode
- The normalization mode.options
- The normalization options, ORed together (0 for no options).@Deprecated public Object clone()
Normalizer2
instead.CharacterIterator
that was passed in to the constructor
or to setText
.
However, the text storage underlying
the CharacterIterator is not duplicated unless the
iterator's clone method does so.@Deprecated public static String compose(String str, boolean compat)
Normalizer2
instead.str
- The string to compose.compat
- If true the string will be composed according to
NFKC rules and if false will be composed according to
NFC rules.@Deprecated public static String compose(String str, boolean compat, int options)
Normalizer2
instead.str
- The string to compose.compat
- If true the string will be composed according to
NFKC rules and if false will be composed according to
NFC rules.options
- The only recognized option is UNICODE_3_2@Deprecated public static int compose(char[] source, char[] target, boolean compat, int options)
Normalizer2
instead.source
- The char array to compose.target
- A char buffer to receive the normalized text.compat
- If true the char array will be composed according to
NFKC rules and if false will be composed according to
NFC rules.options
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if target.length is less than the
required length@Deprecated public static int compose(char[] src, int srcStart, int srcLimit, char[] dest, int destStart, int destLimit, boolean compat, int options)
Normalizer2
instead.src
- The char array to compose.srcStart
- Start index of the sourcesrcLimit
- Limit index of the sourcedest
- The char buffer to fill indestStart
- Start index of the destination bufferdestLimit
- End index of the destination buffercompat
- If true the char array will be composed according to
NFKC rules and if false will be composed according to
NFC rules.options
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if target.length is less than the
required length@Deprecated public static String decompose(String str, boolean compat)
Normalizer2
instead.str
- The string to decompose.compat
- If true the string will be decomposed according to NFKD
rules and if false will be decomposed according to NFD
rules.@Deprecated public static String decompose(String str, boolean compat, int options)
Normalizer2
instead.str
- The string to decompose.compat
- If true the string will be decomposed according to NFKD
rules and if false will be decomposed according to NFD
rules.options
- The normalization options, ORed together (0 for no options).@Deprecated public static int decompose(char[] source, char[] target, boolean compat, int options)
Normalizer2
instead.source
- The char array to decompose.target
- A char buffer to receive the normalized text.compat
- If true the char array will be decomposed according to NFKD
rules and if false will be decomposed according to
NFD rules.options
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if the target capacity is less than
the required length@Deprecated public static int decompose(char[] src, int srcStart, int srcLimit, char[] dest, int destStart, int destLimit, boolean compat, int options)
Normalizer2
instead.src
- The char array to compose.srcStart
- Start index of the sourcesrcLimit
- Limit index of the sourcedest
- The char buffer to fill indestStart
- Start index of the destination bufferdestLimit
- End index of the destination buffercompat
- If true the char array will be decomposed according to NFKD
rules and if false will be decomposed according to
NFD rules.options
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if the target capacity is less than
the required length@Deprecated public static String normalize(String str, Normalizer.Mode mode, int options)
Normalizer2
instead.
The options parameter specifies which optional
Normalizer features are to be enabled for this operation.
Currently the only available option is UNICODE_3_2
.
If you want the default behavior corresponding to one of the standard
Unicode Normalization Forms, use 0 for this argument.
str
- the input string to be normalized.mode
- the normalization modeoptions
- the optional features to be enabled.@Deprecated public static String normalize(String src, Normalizer.Mode mode)
Normalizer2
instead.src
- The string to normalize.mode
- The normalization mode; one of Normalizer.NONE,
Normalizer.NFD, Normalizer.NFC, Normalizer.NFKC,
Normalizer.NFKD, Normalizer.DEFAULT@Deprecated public static int normalize(char[] source, char[] target, Normalizer.Mode mode, int options)
Normalizer2
instead.source
- The char array to normalize.target
- A char buffer to receive the normalized text.mode
- The normalization mode; one of Normalizer.NONE,
Normalizer.NFD, Normalizer.NFC, Normalizer.NFKC,
Normalizer.NFKD, Normalizer.DEFAULToptions
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if the target capacity is less
than the required length@Deprecated public static int normalize(char[] src, int srcStart, int srcLimit, char[] dest, int destStart, int destLimit, Normalizer.Mode mode, int options)
Normalizer2
instead.src
- The char array to compose.srcStart
- Start index of the sourcesrcLimit
- Limit index of the sourcedest
- The char buffer to fill indestStart
- Start index of the destination bufferdestLimit
- End index of the destination buffermode
- The normalization mode; one of Normalizer.NONE,
Normalizer.NFD, Normalizer.NFC, Normalizer.NFKC,
Normalizer.NFKD, Normalizer.DEFAULToptions
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- if the target capacity is
less than the required length@Deprecated public static String normalize(int char32, Normalizer.Mode mode, int options)
Normalizer2
instead.char32
- The input string to be normalized.mode
- The normalization modeoptions
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2UNICODE_3_2
@Deprecated public static String normalize(int char32, Normalizer.Mode mode)
Normalizer2
instead.char32
- The input string to be normalized.mode
- The normalization mode@Deprecated public static Normalizer.QuickCheckResult quickCheck(String source, Normalizer.Mode mode)
Normalizer2
instead.source
- string for determining if it is in a normalized formatmode
- normalization format (Normalizer.NFC,Normalizer.NFD,
Normalizer.NFKC,Normalizer.NFKD)@Deprecated public static Normalizer.QuickCheckResult quickCheck(String source, Normalizer.Mode mode, int options)
Normalizer2
instead.source
- string for determining if it is in a normalized formatmode
- normalization format (Normalizer.NFC,Normalizer.NFD,
Normalizer.NFKC,Normalizer.NFKD)options
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2@Deprecated public static Normalizer.QuickCheckResult quickCheck(char[] source, Normalizer.Mode mode, int options)
Normalizer2
instead.source
- Array of characters for determining if it is in a
normalized formatmode
- normalization format (Normalizer.NFC,Normalizer.NFD,
Normalizer.NFKC,Normalizer.NFKD)options
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2@Deprecated public static Normalizer.QuickCheckResult quickCheck(char[] source, int start, int limit, Normalizer.Mode mode, int options)
Normalizer2
instead.source
- string for determining if it is in a normalized formatstart
- the start index of the sourcelimit
- the limit index of the source it is equal to the lengthmode
- normalization format (Normalizer.NFC,Normalizer.NFD,
Normalizer.NFKC,Normalizer.NFKD)options
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2@Deprecated public static boolean isNormalized(char[] src, int start, int limit, Normalizer.Mode mode, int options)
Normalizer2
instead.src
- The input array of characters to be checked to see if
it is normalizedstart
- The strart index in the sourcelimit
- The limit index in the sourcemode
- the normalization modeoptions
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2@Deprecated public static boolean isNormalized(String str, Normalizer.Mode mode, int options)
Normalizer2
instead.str
- the input string to be checked to see if it is
normalizedmode
- the normalization modeoptions
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2isNormalized(char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
@Deprecated public static boolean isNormalized(int char32, Normalizer.Mode mode, int options)
Normalizer2
instead.char32
- the input code point to be checked to see if it is
normalizedmode
- the normalization modeoptions
- Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2isNormalized(char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
public static int compare(char[] s1, int s1Start, int s1Limit, char[] s2, int s2Start, int s2Limit, int options)
s1
- First source character array.s1Start
- start index of sources1Limit
- limit of the sources2
- Second source character array.s2Start
- start index of the sources2Limit
- limit of the sourceoptions
- A bit set of options:
- FOLD_CASE_DEFAULT or 0 is used for default options:
Case-sensitive comparison in code unit order, and the input strings
are quick-checked for FCD.
- INPUT_IS_FCD
Set if the caller knows that both s1 and s2 fulfill the FCD
conditions.If not set, the function will quickCheck for FCD
and normalize if necessary.
- COMPARE_CODE_POINT_ORDER
Set to choose code point order instead of code unit order
- COMPARE_IGNORE_CASE
Set to compare strings case-insensitively using case folding,
instead of case-sensitively.
If set, then the following case folding options are used.normalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
FCD
public static int compare(String s1, String s2, int options)
s1
- First source string.s2
- Second source string.options
- A bit set of options:
- FOLD_CASE_DEFAULT or 0 is used for default options:
Case-sensitive comparison in code unit order, and the input strings
are quick-checked for FCD.
- INPUT_IS_FCD
Set if the caller knows that both s1 and s2 fulfill the FCD
conditions. If not set, the function will quickCheck for FCD
and normalize if necessary.
- COMPARE_CODE_POINT_ORDER
Set to choose code point order instead of code unit order
- COMPARE_IGNORE_CASE
Set to compare strings case-insensitively using case folding,
instead of case-sensitively.
If set, then the following case folding options are used.normalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
FCD
public static int compare(char[] s1, char[] s2, int options)
s1
- First source string.s2
- Second source string.options
- A bit set of options:
- FOLD_CASE_DEFAULT or 0 is used for default options:
Case-sensitive comparison in code unit order, and the input strings
are quick-checked for FCD.
- INPUT_IS_FCD
Set if the caller knows that both s1 and s2 fulfill the FCD
conditions. If not set, the function will quickCheck for FCD
and normalize if necessary.
- COMPARE_CODE_POINT_ORDER
Set to choose code point order instead of code unit order
- COMPARE_IGNORE_CASE
Set to compare strings case-insensitively using case folding,
instead of case-sensitively.
If set, then the following case folding options are used.normalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
FCD
public static int compare(int char32a, int char32b, int options)
char32a
- the first code point to be checked against thechar32b
- the second code pointoptions
- A bit set of optionspublic static int compare(int char32a, String str2, int options)
char32a
- the first code point to be checked againststr2
- the second stringoptions
- A bit set of options@Deprecated public static int concatenate(char[] left, int leftStart, int leftLimit, char[] right, int rightStart, int rightLimit, char[] dest, int destStart, int destLimit, Normalizer.Mode mode, int options)
Normalizer2
instead.
dest=normalize(left+right, mode)
With the input strings already being normalized,
this function will use next() and previous()
to find the adjacent end pieces of the input strings.
Only the concatenation of these end pieces will be normalized and
then concatenated with the remaining parts of the input strings.
It is allowed to have dest==left to avoid copying the entire left string.left
- Left source array, may be same as dest.leftStart
- start in the left array.leftLimit
- limit in the left array (==length)right
- Right source array.rightStart
- start in the right array.rightLimit
- limit in the right array (==length)dest
- The output buffer; can be null if destStart==destLimit==0
for pure preflighting.destStart
- start in the destination arraydestLimit
- limit in the destination array (==length)mode
- The normalization mode.options
- The normalization options, ORed together (0 for no options).IndexOutOfBoundsException
- whose message has the string
representation of destination capacity required.IndexOutOfBoundsException
- if target capacity is less than the
required lengthnormalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
next()
,
previous()
@Deprecated public static String concatenate(char[] left, char[] right, Normalizer.Mode mode, int options)
Normalizer2
instead.
dest=normalize(left+right, mode)
For details see concatenateleft
- Left source string.right
- Right source string.mode
- The normalization mode.options
- The normalization options, ORed together (0 for no options).concatenate(char[], int, int, char[], int, int, char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
,
normalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
next()
,
previous()
,
concatenate(char[], int, int, char[], int, int, char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
@Deprecated public static String concatenate(String left, String right, Normalizer.Mode mode, int options)
Normalizer2
instead.
dest=normalize(left+right, mode)
With the input strings already being normalized,
this function will use next() and previous()
to find the adjacent end pieces of the input strings.
Only the concatenation of these end pieces will be normalized and
then concatenated with the remaining parts of the input strings.left
- Left source string.right
- Right source string.mode
- The normalization mode.options
- The normalization options, ORed together (0 for no options).concatenate(char[], int, int, char[], int, int, char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
,
normalize(java.lang.String, com.ibm.icu.text.Normalizer.Mode, int)
,
next()
,
previous()
,
concatenate(char[], int, int, char[], int, int, char[], int, int, com.ibm.icu.text.Normalizer.Mode, int)
@Deprecated public static int getFC_NFKC_Closure(int c, char[] dest)
c
- The code point whose closure value is to be retrieveddest
- The char array to receive the closure value@Deprecated public static String getFC_NFKC_Closure(int c)
c
- The code point whose closure value is to be retrieved@Deprecated public int current()
@Deprecated public int next()
DONE
is returned.@Deprecated public int previous()
DONE
is returned.@Deprecated public void reset()
@Deprecated public void setIndexOnly(int index)
index
- the desired index in the input text.@Deprecated public int setIndex(int index)
Note: This method sets the position in the input text,
while next()
and previous()
iterate through characters
in the normalized output. This means that there is not
necessarily a one-to-one correspondence between characters returned
by next and previous and the indices passed to and
returned from setIndex and getIndex()
.
index
- the desired index in the input text.IllegalArgumentException
- if the given index is less than
getBeginIndex()
or greater than getEndIndex()
.@Deprecated public int getBeginIndex()
startIndex()
@Deprecated public int getEndIndex()
endIndex()
@Deprecated public int first()
@Deprecated public int last()
@Deprecated public int getIndex()
Note: This method sets the position in the input, while
next()
and previous()
iterate through characters in the
output. This means that there is not necessarily a one-to-one
correspondence between characters returned by next and
previous and the indices passed to and returned from
setIndex and getIndex()
.
@Deprecated public int startIndex()
@Deprecated public int endIndex()
@Deprecated public void setMode(Normalizer.Mode newMode)
Note:If the normalization mode is changed while iterating
over a string, calls to next()
and previous()
may
return previously buffers characters in the old normalization mode
until the iteration is able to re-sync at the next base character.
It is safest to call setText()
, first()
,
last()
, etc. after calling setMode.
newMode
- the new mode for this Normalizer.
The supported modes are:
NFC
- Unicode canonical decompositiion
followed by canonical composition.
NFKC
- Unicode compatibility decompositiion
followed by canonical composition.
NFD
- Unicode canonical decomposition
NFKD
- Unicode compatibility decomposition.
NONE
- Do nothing but return characters
from the underlying input text.
getMode()
@Deprecated public Normalizer.Mode getMode()
@Deprecated public void setOption(int option, boolean value)
UNICODE_3_2
- Use Normalization conforming to Unicode version 3.2.
option
- the option whose value is to be set.value
- the new setting for the option. Use true to
turn the option on and false to turn it off.getOption(int)
@Deprecated public int getOption(int option)
setOption(int, boolean)
@Deprecated public int getText(char[] fillIn)
fillIn
- the char buffer to fill the UTF-16 units.
The length of the buffer should be equal to the length of the
underlying text storageIndexOutOfBoundsException
- If the index passed for the array is invalid.getLength()
@Deprecated public int getLength()
@Deprecated public String getText()
@Deprecated public void setText(StringBuffer newText)
newText
- The new string to be normalized.@Deprecated public void setText(char[] newText)
newText
- The new string to be normalized.@Deprecated public void setText(String newText)
newText
- The new string to be normalized.@Deprecated public void setText(CharacterIterator newText)
newText
- The new string to be normalized.@Deprecated public void setText(UCharacterIterator newText)
newText
- The new string to be normalized.Copyright © 2016 Unicode, Inc. and others.