CapitalizationMode

enum CapitalizationMode : Enum<CapitalizationMode>

A mode in which a word should be capitalized.

Entries

Link copied to clipboard
RANDOM("random", { string, random -> string.toCharArray().map { it.toRandomCase(random) }.joinToString("") })

Makes each letter randomly uppercase or lowercase.

Link copied to clipboard
FIRST_LETTER("first letter", { string, _ -> string.split(' ').joinToString(" ") { it.toSentenceCase() } })

Makes the first letter of each word uppercase.

Link copied to clipboard
LOWER("lower", { string, _ -> string.lowercase(Locale.getDefault()) })

Makes all characters lowercase.

Link copied to clipboard
UPPER("upper", { string, _ -> string.uppercase(Locale.getDefault()) })

Makes all characters uppercase.

Link copied to clipboard
SENTENCE("sentence", { string, _ -> string.toSentenceCase() })

Makes the first character uppercase and all characters after that lowercase.

Link copied to clipboard
RETAIN("retain", { string, _ -> string })

Does not change the string.

Types

Link copied to clipboard
object Companion

Holds static elements.

Functions

Link copied to clipboard
open override fun toString(): String

Returns the descriptor of the capitalization mode.

Link copied to clipboard
fun transform(string: String, random: Random = Random.Default): String

Invokes transformer with random.

Properties

Link copied to clipboard
val descriptor: String

the name of the capitalization mode

Link copied to clipboard
val name: String
Link copied to clipboard
val ordinal: Int

Sources

Link copied to clipboard