Title
class Title : CaseMap
kotlin.Any | ||
↳ | android.icu.text.CaseMap | |
↳ | android.icu.text.CaseMap.Title |
Titlecasing options and methods. Immutable.
Summary
Public methods | |
---|---|
CaseMap.Title! |
Returns an instance that behaves like this one but adjusts each titlecasing BreakIterator index to the next cased character. |
String! |
apply(locale: Locale!, iter: BreakIterator!, src: CharSequence!) Titlecases a string. |
A |
apply(locale: Locale!, iter: BreakIterator!, src: CharSequence!, dest: A, edits: Edits!) Titlecases a string and optionally records edits (see |
CaseMap.Title! |
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! |
Returns an instance that behaves like this one but does not lowercase non-initial parts of words when titlecasing. |
CaseMap.Title! |
Returns an instance that behaves like this one but omits unchanged text when case-mapping with |
CaseMap.Title! |
Returns an instance that behaves like this one but titlecases sentences rather than words. |
CaseMap.Title! |
Returns an instance that behaves like this one but titlecases the string as a whole rather than each word. |
Inherited functions | |
---|---|
Public methods
adjustToCased
fun adjustToCased(): CaseMap.Title!
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.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
See Also
apply
fun apply(
locale: Locale!,
iter: BreakIterator!,
src: CharSequence!
): String!
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 java.util.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. |
Return | |
---|---|
String! |
the result string. |
apply
fun <A : Appendable!> apply(
locale: Locale!,
iter: BreakIterator!,
src: CharSequence!,
dest: A,
edits: Edits!
): A
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 java.util.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. |
Return | |
---|---|
A |
dest with the result string (or only changes) appended. |
noBreakAdjustment
fun noBreakAdjustment(): CaseMap.Title!
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.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
noLowercase
fun noLowercase(): CaseMap.Title!
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.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
omitUnchangedText
fun omitUnchangedText(): CaseMap.Title!
Returns an instance that behaves like this one but omits unchanged text when case-mapping with Edits
.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
sentences
fun sentences(): CaseMap.Title!
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.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
See Also
wholeString
fun wholeString(): CaseMap.Title!
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.
Return | |
---|---|
CaseMap.Title! |
an options object with this option. |
See Also