除了String的replace方法和replaceAll
还有MessageFormat.
String str1 = "大秦 {0} {1} {2}";
System.out.println(MessageFormat.format(str1, "将军", "梦回", "秦朝"));
本文介绍了如何使用Java中的MessageFormat类来格式化字符串,通过示例展示了如何将占位符替换为具体的值。
除了String的replace方法和replaceAll
还有MessageFormat.
String str1 = "大秦 {0} {1} {2}";
System.out.println(MessageFormat.format(str1, "将军", "梦回", "秦朝"));
756

被折叠的 条评论
为什么被折叠?