首页 > 解决方案 > Is there posibility to disable "string templates"?

问题描述

Kotlin have amazing, which is not present in java, but it is possible to do not use it somehow? Like for example in php:

"$foo"
'$foo'

标签: kotlin

解决方案


你不能禁用。但是您可以使用\.

val my_variable = "Some Value"
println("this --> \$my_variable")

上面的代码将打印this --> $my_variable


推荐阅读