CapitalizationMode

enum CapitalizationMode : Enum<CapitalizationMode>

A mode in which a word should be capitalized.

Parameters

descriptor

the name of the capitalization mode

transform

the function which capitalizes the given string to the mode's format

Entries

RANDOM
Link copied to clipboard
RANDOM("random", { string -> string.toCharArray().map { it.toRandomCase() }.joinToString("") })
Makes each letter randomly uppercase or lowercase.
FIRST_LETTER
Link copied to clipboard
FIRST_LETTER("first letter", { string -> string.split(' ').joinToString(" ") { it.toSentenceCase() } })
Makes the first letter of each word uppercase.
LOWER
Link copied to clipboard
LOWER("lower", { string -> string.lowercase(Locale.getDefault()) })
Makes all characters lowercase.
UPPER
Link copied to clipboard
UPPER("upper", { string -> string.uppercase(Locale.getDefault()) })
Makes all characters uppercase.
SENTENCE
Link copied to clipboard
SENTENCE("sentence", { string -> string.toSentenceCase() })
Makes the first character uppercase and all characters after that lowercase.
RETAIN
Link copied to clipboard
RETAIN("retain", { string -> string })
Does not change the string.

Types

Companion
Link copied to clipboard
object Companion
Holds static elements.

Functions

toString
Link copied to clipboard
open override fun toString(): String
Returns the descriptor of the capitalization mode.

Properties

descriptor
Link copied to clipboard
val descriptor: String
the name of the capitalization mode
name
Link copied to clipboard
val name: String
ordinal
Link copied to clipboard
val ordinal: Int
transform
Link copied to clipboard
val transform: (String) -> String
the function which capitalizes the given string to the mode's format

Sources

jvm source
Link copied to clipboard