public class StrFormatter extends Object
Constructor and Description |
---|
StrFormatter() |
Modifier and Type | Method and Description |
---|---|
static String |
format(String strPattern,
Object... argArray)
格式化字符串
此方法只是简单将占位符 {} 按照顺序替换为参数 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可 例: 通常使用:format("this is {} for {}", "a", "b") =》 this is a for b 转义{}: format("this is \\{} for {}", "a", "b") =》 this is \{} for a 转义\: format("this is \\\\{} for {}", "a", "b") =》 this is \a for b |
public static String format(String strPattern, Object... argArray)
strPattern
- 字符串模板argArray
- 参数列表Copyright © 2021. All rights reserved.