Back to Intellij Community

CanConvertToMultiDollarString

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/CanConvertToMultiDollarString.html

2025.3-rc-2563 B
Original Source

Reports that a string can benefit from a conversion to a version with a multi-dollar interpolation prefix.

An interpolation prefix may make a string easier to comprehend, since prefixed strings can use dollar literals without additional escaping.

Example:

val jsonSchema: String = """
{
  "${'$'}id": "https://example.com/product.schema.json",
}"""

The quick fix converts all safely replaceable escaped dollar characters to regular dollar characters:

val jsonSchema: String = $$"""
{
  "$id": "https://example.com/product.schema.json",
}"""