W3cubDocs

/Kotlin

format

Platform and version requirements: JVM (1.0)
fun String.format(vararg args: Any?): String

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the default locale.

Platform and version requirements: JVM (1.0)
fun String.Companion.format(
    format: String, 
    vararg args: Any?
): String

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the default locale.

Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4") fun String.format(
    locale: Locale, 
    vararg args: Any?
): String
Deprecated: Use Kotlin compiler 1.4 to avoid deprecation warning.

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the specified locale.

Platform and version requirements: JVM (1.4)
@JvmName("formatNullable") fun String.format(
    locale: Locale?, 
    vararg args: Any?
): String

Uses this string as a format string and returns a string obtained by substituting the specified arguments, using the specified locale. If locale is null then no localization is applied.

Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4") fun String.Companion.format(
    locale: Locale, 
    format: String, 
    vararg args: Any?
): String
Deprecated: Use Kotlin compiler 1.4 to avoid deprecation warning.

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the specified locale.

Platform and version requirements: JVM (1.4)
@JvmName("formatNullable") fun String.Companion.format(
    locale: Locale?, 
    format: String, 
    vararg args: Any?
): String

Uses the provided format as a format string and returns a string obtained by substituting the specified arguments, using the specified locale. If locale is null then no localization is applied.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/format.html