[如果我有一行代码,例如String formattedString = String.format("... {}", objectToBeInserted);
,我希望将objectToBeInserted插入到{}
所在的字符串中,如果我不一定知道objectToBeInserted(因此不能使用%d之类的东西。
如果我有一行代码,例如String formattedString = String.format(“ ... {}”,objectToBeInserted);,我想将objectToBeInserted插入到{}所在的字符串中,我该怎么办...
我不完全确定为什么您在问题末尾提到%d时,实际上并没有在您提到的格式字符串中出现它。