Inspectopedia Help

'String.format' call can be replaced with string templates

Reports String.format calls that can be replaced with string templates.

Using string templates makes your code simpler.

The quick-fix replaces the call with a string template.

Example:

fun main() { val id = "abc" val date = "123" val s = String.format("%s_%s_%s", id, date, id) }

After the quick-fix is applied:

fun main() { val id = "abc" val date = "123" val s = "${id}_${date}_$id" }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023