public static final class CaseMap.Title extends CaseMap
CaseMap.toTitle()
CaseMap.Fold, CaseMap.Lower, CaseMap.Title, CaseMap.Upper
internalOptions
Modifier and Type | Method and Description |
---|---|
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> |
apply(Locale locale,
BreakIterator iter,
CharSequence src,
A dest,
Edits edits)
Titlecases a string and optionally records edits (see
omitUnchangedText() ). |
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
Edits . |
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.
|
public CaseMap.Title wholeString()
It is an error to specify multiple titlecasing iterator options together, including both an option and an explicit BreakIterator.
adjustToCased()
public CaseMap.Title sentences()
It is an error to specify multiple titlecasing iterator options together, including both an option and an explicit BreakIterator.
adjustToCased()
public CaseMap.Title omitUnchangedText()
Edits
.omitUnchangedText
in class CaseMap
public CaseMap.Title noLowercase()
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.
UCharacter.TITLECASE_NO_LOWERCASE
,
adjustToCased()
public CaseMap.Title noBreakAdjustment()
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.
UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT
public CaseMap.Title adjustToCased()
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.
noBreakAdjustment()
public String apply(Locale locale, BreakIterator iter, CharSequence src)
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.)
locale
- The locale ID. Can be null for Locale.getDefault()
.
(See ULocale.toLocale()
.)iter
- 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
- The original string.UCharacter.toUpperCase(Locale, String)
public <A extends Appendable> A apply(Locale locale, BreakIterator iter, CharSequence src, A dest, Edits edits)
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.)
locale
- The locale ID. Can be null for Locale.getDefault()
.
(See ULocale.toLocale()
.)iter
- 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
- The original string.dest
- A buffer for the result string. Must not be null.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.UCharacter.toTitleCase(Locale, String, BreakIterator, int)
Copyright © 2016 Unicode, Inc. and others.