public class Placeholder extends Object
| 构造器和说明 |
|---|
Placeholder() |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
format(String needReplaceString,
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 |
String |
wrap(String str,
String prefix,
String suffix)
包装指定字符串
|
public String format(String needReplaceString, Object... argArray)
needReplaceString - 字符串模板argArray - 参数列表Copyright © 2017. All rights reserved.