Padding

The style of padding to use when formatting a value.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Defining a custom format that uses various padding rules
val format = LocalDate.Format {
    year(Padding.SPACE)
    chars(", ")
    monthNumber(Padding.NONE)
    char('/')
    dayOfMonth(Padding.ZERO)
}
val leoFirstReignStart = LocalDate(457, 2, 7)
check(leoFirstReignStart.format(format) == " 457, 2/07") 
   //sampleEnd
}

Entries

Link copied to clipboard

No padding during formatting. Parsing does not require padding, but it is allowed.

Link copied to clipboard

Pad with zeros during formatting. During parsing, padding is required; otherwise, parsing fails.

Link copied to clipboard

Pad with spaces during formatting. During parsing, padding is required; otherwise, parsing fails.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Functions

Link copied to clipboard
fun valueOf(value: String): Padding

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.