CaseMap.Title
public
static
final
class
CaseMap.Title
extends CaseMap
java.lang.Object | ||
↳ | android.icu.text.CaseMap | |
↳ | android.icu.text.CaseMap.Title |
Titlecasing options and methods. Immutable.
See also:
Summary
Public methods | |
---|---|
CaseMap.Title
|
adjustToCased()
Returns an instance that behaves like this one but adjusts each titlecasing BreakIterator index to the next cased character. |
String
|
apply(Locale locale, BreakIterator iter, CharSequence src)
Titlecases a string. |
<A extends Appendable>
A
|
apply(Locale locale, BreakIterator iter, CharSequence src, A dest, Edits edits)
Titlecases a string and optionally records edits (see |
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. |
CaseMap.Title
|
noLowercase()
Returns an instance that behaves like this one but does not lowercase non-initial parts of words when titlecasing. |
CaseMap.Title
|
omitUnchangedText()
Returns an instance that behaves like this one but
omits unchanged text when case-mapping with |
CaseMap.Title
|
sentences()
Returns an instance that behaves like this one but titlecases sentences rather than words. |
CaseMap.Title
|
wholeString()
Returns an instance that behaves like this one but titlecases the string as a whole rather than each word. |
Inherited methods | |
---|---|
Public methods
adjustToCased
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 "«\u4e30(abc)»" instead of "49Ers" and "«\u4e30(Abc)»".
It is an error to specify multiple titlecasing adjustment options together.
Returns | |
---|---|
CaseMap.Title |
an options object with this option. |
See also:
apply
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. |
See also:
apply
public 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. |
noBreakAdjustment
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. |
See also:
noLowercase
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. |
omitUnchangedText
public CaseMap.Title 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. |
sentences
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. |
See also:
wholeString
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. |
See also: