如何在java文本块中为变量值设置占位符
如何将变量放入java文本块
就像
"""
{
...
"someKey": "someValue",
"date": "${LocalDate.now()}",
...
}
"""
你可以在下面搜索框中键入要查询的问题!
如何将变量放入java文本块
就像
"""
{
...
"someKey": "someValue",
"date": "${LocalDate.now()}",
...
}
"""
# 1 楼答案
可以在文本块中使用
%s
作为占位符并用format替换它
从jeps 355 docs
注意:但是作为java-13文档的旁注
String.formatted
被弃用,建议使用String.format(this, args).