chars

abstract fun chars(value: String)(source)

A literal string.

When formatting, the string is appended to the result as is, and when parsing, the string is expected to be present in the input verbatim.

Samples

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

fun main() { 
   //sampleStart 
   // Defining a custom format that includes verbatim strings
val format = LocalDate.Format {
    monthNumber()
    char('/')
    dayOfMonth()
    chars(", ")
    year()
}
check(LocalDate(2020, 1, 13).format(format) == "01/13, 2020") 
   //sampleEnd
}