char
A literal character.
This is a shorthand for chars(value.toString())
.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Defining a custom format that includes a verbatim character
val format = LocalDate.Format {
year()
char('-')
monthNumber()
char('-')
dayOfMonth()
}
check(LocalDate(2020, 1, 1).format(format) == "2020-01-01")
//sampleEnd
}