Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public abstract Class CaseMap

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.text.CaseMap.Lower, com.ibm.icu.text.CaseMap.Upper, com.ibm.icu.text.CaseMap.Title, com.ibm.icu.text.CaseMap.Fold
Imports
java.util.Locale, com.ibm.icu.impl.CaseMapImpl, .UCaseProps, com.ibm.icu.lang.UCharacter, com.ibm.icu.util.ULocale

Low-level case mapping options and methods. Immutable. "Setters" return instances with the union of the current and new options set. This class is not intended for public subclassing.
ICU Status
Stable since ICU 59.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CaseMap.Fold

Case folding options and methods.

public static class
CaseMap.Lower

Lowercasing options and methods.

public static class
CaseMap.Title

Titlecasing options and methods.

public static class
CaseMap.Upper

Uppercasing options and methods.

Field Summary

Modifier and TypeField and Description
protected int
internalOptions

Deprecated This API is ICU internal only.

Constructor Summary

AccessConstructor and Description
private
CaseMap(int opt)

Method Summary

Modifier and TypeMethod and Description
public static CaseMap.Fold

Returns:

Case folding object with default options.
fold
()

private static int
public abstract CaseMap

Returns:

an options object with this option.
omitUnchangedText
()

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

public static CaseMap.Lower

Returns:

Lowercasing object with default options.
toLower
()

public static CaseMap.Title

Returns:

Titlecasing object with default options.
toTitle
()

public static CaseMap.Upper

Returns:

Uppercasing object with default options.
toUpper
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

internalOptionsback to summary
protected int internalOptions

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
ICU Status
Internal ICU component.

Constructor Detail

CaseMapback to summary
private CaseMap(int opt)

Method Detail

foldback to summary
public static CaseMap.Fold fold()
Returns:CaseMap.Fold

Case folding object with default options.

ICU Status
Stable since ICU 59.
getCaseLocaleback to summary
private static int getCaseLocale(Locale locale)
omitUnchangedTextback to summary
public abstract CaseMap omitUnchangedText()

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

Returns:CaseMap

an options object with this option.

ICU Status
Stable since ICU 59.
toLowerback to summary
public static CaseMap.Lower toLower()
Returns:CaseMap.Lower

Lowercasing object with default options.

ICU Status
Stable since ICU 59.
toTitleback to summary
public static CaseMap.Title toTitle()
Returns:CaseMap.Title

Titlecasing object with default options.

ICU Status
Stable since ICU 59.
toUpperback to summary
public static CaseMap.Upper toUpper()
Returns:CaseMap.Upper

Uppercasing object with default options.

ICU Status
Stable since ICU 59.
com.ibm.icu.text back to summary

public final Class CaseMap.Fold

extends CaseMap
Class Inheritance

Case folding options and methods. Immutable.
ICU Status
Stable since ICU 59.
See Also
fold()

Field Summary

Modifier and TypeField and Description
private static final CaseMap.Fold
private static final CaseMap.Fold
private static final CaseMap.Fold
private static final CaseMap.Fold
Inherited from com.ibm.icu.text.CaseMap:
internalOptions

Constructor Summary

AccessConstructor and Description
private
Fold(int opt)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the result string.
apply
(CharSequence
The original string.
src
)

Case-folds a string.

public <A extends Appendable> A

Returns:

dest with the result string (or only changes) appended.
apply
(CharSequence
The original string.
src
,
A
A buffer for the result string. Must not be null.
dest
,
Edits
Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.
edits
)

Case-folds a string and optionally records edits (see omitUnchangedText).

public CaseMap.Fold
omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.
public CaseMap.Fold

Returns:

an options object with this option.
turkic
()

Returns an instance that behaves like this one but handles dotted I and dotless i appropriately for Turkic languages (tr, az).

Inherited from com.ibm.icu.text.CaseMap:
foldtoLowertoTitletoUpper

Field Detail

DEFAULTback to summary
private static final CaseMap.Fold DEFAULT
OMIT_UNCHANGEDback to summary
private static final CaseMap.Fold OMIT_UNCHANGED
TURKICback to summary
private static final CaseMap.Fold TURKIC
TURKIC_OMIT_UNCHANGEDback to summary
private static final CaseMap.Fold TURKIC_OMIT_UNCHANGED

Constructor Detail

Foldback to summary
private Fold(int opt)

Method Detail

applyback to summary
public String apply(CharSequence src)

Case-folds a string. The result may be longer or shorter than the original.

Case-folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'T' in CaseFolding.txt.

Parameters
src:CharSequence

The original string.

Returns:String

the result string.

ICU Status
Stable since ICU 60.
See Also
UCharacter#foldCase(String, int)
applyback to summary
public <A extends Appendable> A apply(CharSequence src, A dest, Edits edits)

Case-folds a string and optionally records edits (see omitUnchangedText). The result may be longer or shorter than the original.

Case-folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'T' in CaseFolding.txt.

Parameters
src:CharSequence

The original string.

dest:A

A buffer for the result string. Must not be null.

edits:Edits

Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.

Returns:A

dest with the result string (or only changes) appended.

ICU Status
Stable since ICU 59.
See Also
UCharacter#foldCase(String, int)
omitUnchangedTextback to summary
public CaseMap.Fold omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Doc from com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

Returns:CaseMap.Fold

an options object with this option.

Annotations
@Override
ICU Status
Stable since ICU 59.
turkicback to summary
public CaseMap.Fold turkic()

Returns an instance that behaves like this one but handles dotted I and dotless i appropriately for Turkic languages (tr, az).

Uses the Unicode CaseFolding.txt mappings marked with 'T' that are to be excluded for default mappings and included for the Turkic-specific mappings.

Returns:CaseMap.Fold

an options object with this option.

ICU Status
Stable since ICU 59.
See Also
UCharacter#FOLD_CASE_EXCLUDE_SPECIAL_I
com.ibm.icu.text back to summary

public final Class CaseMap.Lower

extends CaseMap
Class Inheritance

Lowercasing options and methods. Immutable.
ICU Status
Stable since ICU 59.
See Also
toLower()

Field Summary

Modifier and TypeField and Description
private static final CaseMap.Lower
private static final CaseMap.Lower
Inherited from com.ibm.icu.text.CaseMap:
internalOptions

Constructor Summary

AccessConstructor and Description
private
Lower(int opt)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the result string.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
CharSequence
The original string.
src
)

Lowercases a string.

public <A extends Appendable> A

Returns:

dest with the result string (or only changes) appended.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
CharSequence
The original string.
src
,
A
A buffer for the result string. Must not be null.
dest
,
Edits
Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.
edits
)

Lowercases a string and optionally records edits (see omitUnchangedText).

public CaseMap.Lower
omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.
Inherited from com.ibm.icu.text.CaseMap:
foldtoLowertoTitletoUpper

Field Detail

DEFAULTback to summary
private static final CaseMap.Lower DEFAULT
OMIT_UNCHANGEDback to summary
private static final CaseMap.Lower OMIT_UNCHANGED

Constructor Detail

Lowerback to summary
private Lower(int opt)

Method Detail

applyback to summary
public String apply(Locale locale, CharSequence src)

Lowercases a string. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

src:CharSequence

The original string.

Returns:String

the result string.

ICU Status
Stable since ICU 60.
See Also
UCharacter#toLowerCase(Locale, String)
applyback to summary
public <A extends Appendable> A apply(Locale locale, CharSequence src, A dest, Edits edits)

Lowercases a string and optionally records edits (see omitUnchangedText). Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

src:CharSequence

The original string.

dest:A

A buffer for the result string. Must not be null.

edits:Edits

Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.

Returns:A

dest with the result string (or only changes) appended.

ICU Status
Stable since ICU 59.
See Also
UCharacter#toLowerCase(Locale, String)
omitUnchangedTextback to summary
public CaseMap.Lower omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Doc from com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

Returns:CaseMap.Lower

an options object with this option.

Annotations
@Override
ICU Status
Stable since ICU 59.
com.ibm.icu.text back to summary

public final Class CaseMap.Title

extends CaseMap
Class Inheritance

Titlecasing options and methods. Immutable.
ICU Status
Stable since ICU 59.
See Also
toTitle()

Field Summary

Modifier and TypeField and Description
private static final CaseMap.Title
private static final CaseMap.Title
Inherited from com.ibm.icu.text.CaseMap:
internalOptions

Constructor Summary

AccessConstructor and Description
private
Title(int opt)

Method Summary

Modifier and TypeMethod and Description
public CaseMap.Title

Returns:

an options object with this option.
adjustToCased
()

Returns an instance that behaves like this one but adjusts each titlecasing BreakIterator index to the next cased character.

public String

Returns:

the result string.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
BreakIterator
A break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If null, then a word break iterator for the locale is used (or something equivalent).
iter
,
CharSequence
The original string.
src
)

Titlecases a string.

public <A extends Appendable> A

Returns:

dest with the result string (or only changes) appended.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
BreakIterator
A break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If null, then a word break iterator for the locale is used (or something equivalent).
iter
,
CharSequence
The original string.
src
,
A
A buffer for the result string. Must not be null.
dest
,
Edits
Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.
edits
)

Titlecases a string and optionally records edits (see omitUnchangedText).

public CaseMap.Title

Returns:

an options object with this option.
noBreakAdjustment
()

Returns an instance that behaves like this one but does not adjust the titlecasing BreakIterator indexes; titlecases exactly the characters at breaks from the iterator.

public CaseMap.Title

Returns:

an options object with this option.
noLowercase
()

Returns an instance that behaves like this one but does not lowercase non-initial parts of words when titlecasing.

public CaseMap.Title
omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.
public CaseMap.Title

Returns:

an options object with this option.
sentences
()

Returns an instance that behaves like this one but titlecases sentences rather than words.

public CaseMap.Title

Returns:

an options object with this option.
wholeString
()

Returns an instance that behaves like this one but titlecases the string as a whole rather than each word.

Inherited from com.ibm.icu.text.CaseMap:
foldtoLowertoTitletoUpper

Field Detail

DEFAULTback to summary
private static final CaseMap.Title DEFAULT
OMIT_UNCHANGEDback to summary
private static final CaseMap.Title OMIT_UNCHANGED

Constructor Detail

Titleback to summary
private Title(int opt)

Method Detail

adjustToCasedback to summary
public CaseMap.Title adjustToCased()

Returns an instance that behaves like this one but adjusts each titlecasing BreakIterator index to the next cased character. (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).)

This used to be the default index adjustment in ICU. Since ICU 60, the default index adjustment is to the next character that is a letter, number, symbol, or private use code point. (Uncased modifier letters are skipped.) The difference in behavior is small for word titlecasing, but the new adjustment is much better for whole-string and sentence titlecasing: It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»".

It is an error to specify multiple titlecasing adjustment options together.

Returns:CaseMap.Title

an options object with this option.

ICU Status
Stable since ICU 60.
See Also
noBreakAdjustment()
applyback to summary
public String apply(Locale locale, BreakIterator iter, CharSequence src)

Titlecases a string. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others. (This can be modified with options bits.)

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

iter:BreakIterator

A break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If null, then a word break iterator for the locale is used (or something equivalent).

src:CharSequence

The original string.

Returns:String

the result string.

ICU Status
Stable since ICU 60.
See Also
UCharacter#toUpperCase(Locale, String)
applyback to summary
public <A extends Appendable> A apply(Locale locale, BreakIterator iter, CharSequence src, A dest, Edits edits)

Titlecases a string and optionally records edits (see omitUnchangedText). Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others. (This can be modified with options bits.)

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

iter:BreakIterator

A break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If null, then a word break iterator for the locale is used (or something equivalent).

src:CharSequence

The original string.

dest:A

A buffer for the result string. Must not be null.

edits:Edits

Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.

Returns:A

dest with the result string (or only changes) appended.

ICU Status
Stable since ICU 59.
See Also
UCharacter#toTitleCase(Locale, String, BreakIterator, int)
noBreakAdjustmentback to summary
public CaseMap.Title noBreakAdjustment()

Returns an instance that behaves like this one but does not adjust the titlecasing BreakIterator indexes; titlecases exactly the characters at breaks from the iterator.

By default, titlecasing will take each break iterator index, adjust it to the next relevant character (see adjustToCased()), and titlecase that one.

Other characters are lowercased.

Returns:CaseMap.Title

an options object with this option.

ICU Status
Stable since ICU 59.
See Also
UCharacter#TITLECASE_NO_BREAK_ADJUSTMENT
noLowercaseback to summary
public CaseMap.Title noLowercase()

Returns an instance that behaves like this one but does not lowercase non-initial parts of words when titlecasing.

By default, titlecasing will titlecase the character at each (possibly adjusted) BreakIterator index and lowercase all other characters up to the next iterator index. With this option, the other characters will not be modified.

Returns:CaseMap.Title

an options object with this option.

ICU Status
Stable since ICU 59.
See Also
UCharacter#TITLECASE_NO_LOWERCASE, adjustToCased()
omitUnchangedTextback to summary
public CaseMap.Title omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Doc from com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

Returns:CaseMap.Title

an options object with this option.

Annotations
@Override
ICU Status
Stable since ICU 59.
sentencesback to summary
public CaseMap.Title sentences()

Returns an instance that behaves like this one but titlecases sentences rather than words. (Titlecases only the first character of each sentence, possibly adjusted.)

It is an error to specify multiple titlecasing iterator options together, including both an option and an explicit BreakIterator.

Returns:CaseMap.Title

an options object with this option.

ICU Status
Stable since ICU 60.
See Also
adjustToCased()
wholeStringback to summary
public CaseMap.Title wholeString()

Returns an instance that behaves like this one but titlecases the string as a whole rather than each word. (Titlecases only the character at index 0, possibly adjusted.)

It is an error to specify multiple titlecasing iterator options together, including both an option and an explicit BreakIterator.

Returns:CaseMap.Title

an options object with this option.

ICU Status
Stable since ICU 60.
See Also
adjustToCased()
com.ibm.icu.text back to summary

public final Class CaseMap.Upper

extends CaseMap
Class Inheritance

Uppercasing options and methods. Immutable.
ICU Status
Stable since ICU 59.
See Also
toUpper()

Field Summary

Modifier and TypeField and Description
private static final CaseMap.Upper
private static final CaseMap.Upper
Inherited from com.ibm.icu.text.CaseMap:
internalOptions

Constructor Summary

AccessConstructor and Description
private
Upper(int opt)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the result string.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
CharSequence
The original string.
src
)

Uppercases a string.

public <A extends Appendable> A

Returns:

dest with the result string (or only changes) appended.
apply
(Locale
The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)
locale
,
CharSequence
The original string.
src
,
A
A buffer for the result string. Must not be null.
dest
,
Edits
Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.
edits
)

Uppercases a string and optionally records edits (see omitUnchangedText).

public CaseMap.Upper
omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.
Inherited from com.ibm.icu.text.CaseMap:
foldtoLowertoTitletoUpper

Field Detail

DEFAULTback to summary
private static final CaseMap.Upper DEFAULT
OMIT_UNCHANGEDback to summary
private static final CaseMap.Upper OMIT_UNCHANGED

Constructor Detail

Upperback to summary
private Upper(int opt)

Method Detail

applyback to summary
public String apply(Locale locale, CharSequence src)

Uppercases a string. Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

src:CharSequence

The original string.

Returns:String

the result string.

ICU Status
Stable since ICU 60.
See Also
UCharacter#toUpperCase(Locale, String)
applyback to summary
public <A extends Appendable> A apply(Locale locale, CharSequence src, A dest, Edits edits)

Uppercases a string and optionally records edits (see omitUnchangedText). Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Parameters
locale:Locale

The locale ID. Can be null for Locale#getDefault. (See ULocale#toLocale.)

src:CharSequence

The original string.

dest:A

A buffer for the result string. Must not be null.

edits:Edits

Records edits for index mapping, working with styled text, and getting only changes (if any). This function calls edits.reset() first. edits can be null.

Returns:A

dest with the result string (or only changes) appended.

ICU Status
Stable since ICU 59.
See Also
UCharacter#toUpperCase(Locale, String)
omitUnchangedTextback to summary
public CaseMap.Upper omitUnchangedText()

Implements abstract com.ibm.icu.text.CaseMap.omitUnchangedText.

Doc from com.ibm.icu.text.CaseMap.omitUnchangedText.

Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits.

Returns:CaseMap.Upper

an options object with this option.

Annotations
@Override
ICU Status
Stable since ICU 59.