小编Car*_*rey的帖子

如果你在String.format中多次获得相同的参数怎么样?

String hello = "Hello";

String.format("%s %s %s %s %s %s", hello, hello, hello, hello, hello, hello);

hello hello hello hello hello hello 
Run Code Online (Sandbox Code Playgroud)

hello变量是否需要在对format方法的调用中重复多次,或者是否有一个简写版本,允许您指定一次应用于所有%s标记的参数?

java string string-formatting

124
推荐指数
4
解决办法
5万
查看次数

标签 统计

java ×1

string ×1

string-formatting ×1