public class StrFormatter extends Object
| Modifier and Type | Field and Description |
|---|---|
static char |
C_BACKSLASH |
static char |
C_DELIM_END |
static char |
C_DELIM_START |
static String |
EMPTY_JSON |
| 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 final String EMPTY_JSON
public static final char C_BACKSLASH
public static final char C_DELIM_START
public static final char C_DELIM_END
public static String format(String strPattern, Object... argArray)
strPattern - 字符串模板argArray - 参数列表Copyright © 2021. All rights reserved.