# Is there a String.format to interpolation codemod?

**URL:** <https://discuss.kotlinlang.org/t/is-there-a-string-format-to-interpolation-codemod/15948>\
**Category:** Uncategorized\
**Created:** [January 18, 2020, 11:46pm UTC](https://discuss.kotlinlang.org/t/is-there-a-string-format-to-interpolation-codemod/15948 "2020-01-18T23:46:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kognise](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/kognise/32/7170_2.png) [@kognise](https://discuss.kotlinlang.org/u/kognise)\
**Post date:** [January 18, 2020, 11:46pm UTC](https://discuss.kotlinlang.org/t/is-there-a-string-format-to-interpolation-codemod/15948/1 "2020-01-18T23:46:35Z")

</div>

I recently wrote a lot of Java code that was littered with `String.format` calls. I converted it all to Kotlin, but I’m wondering if there’s an easy and automated way to convert all the instances of `String.format` to Kotlin-native string interpolation.

For example, `String.format("Hello, %s!", name)` should become `"Hello, ${name}!`.

Thanks!

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [January 20, 2020, 8:26am UTC](https://discuss.kotlinlang.org/t/is-there-a-string-format-to-interpolation-codemod/15948/2 "2020-01-20T08:26:19Z")

</div>

IDEA Java to Kotlin converter should be able to do that, please add concrete use cases to [https://youtrack.jetbrains.com/issue/KT-8946](https://youtrack.jetbrains.com/issue/KT-8946)
