formatTo

abstract fun <A : Appendable> formatTo(appendable: A, value: T): A(source)

Formats the given value into the given appendable using this format.

Throws

if the value does not contain all the information required by the format.

Samples

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

fun main() { 
   //sampleStart 
   // Appending a formatted date to an `Appendable` (e.g. a `StringBuilder`)
val sb = StringBuilder()
sb.append("Today is ")
LocalDate.Formats.ISO.formatTo(sb, LocalDate(2024, 4, 5))
check(sb.toString() == "Today is 2024-04-05") 
   //sampleEnd
}