public class TirsciUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static org.slf4j.Logger |
log |
| 限定符 | 构造器和说明 |
|---|---|
private |
TirsciUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
format(String strPattern,
Object... argArray)
格式化文本, {} 表示占位符
此方法只是简单将占位符 {} 按照顺序替换为参数
如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
例:
// 通常使用 -> 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
format("this is \\\\{} for {}", "a", "b")
|
static <T> T |
tryCatch(SupplierException<T> supplier)
异常捕获起来
|
public static <T> T tryCatch(SupplierException<T> supplier)
T - 类型supplier - 要执行的方法public static String format(String strPattern, Object... argArray)
格式化文本, {} 表示占位符
此方法只是简单将占位符 {} 按照顺序替换为参数
如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
例:
// 通常使用 -> 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
format("this is \\\\{} for {}", "a", "b")
strPattern - 文本模板,被替换的部分用 {} 表示argArray - 参数值Copyright © 2024. All rights reserved.