Multi-dollar String Interpolation in Kotlin
Improve $ handling in string literals
Kotlin’s string interpolation has been a much-liked feature from the beginning, and in this video, we'll learn about how JetBrains is adding more flexibility to it with multi-dollar string interpolation.
To enable it:
- Ensure you are using Kotlin 2.1.0 or later in your project
- Add
-Xmulti-dollar-interpolation
as a compiler argument
For IDE support: Use the latest 2024.3 version of IntelliJ IDEA with K2 mode enabled (requires restart) Get more info here: https://kotlinlang.org/docs/whatsnew21.html#multi-dollar-string-interpolation