类 TirsciUtil
java.lang.Object
cn.sinozg.applet.common.utils.TirsciUtil
工具类 自己用
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
-
字段详细资料
-
log
private static final org.slf4j.Logger log -
random
-
-
构造器详细资料
-
TirsciUtil
private TirsciUtil()
-
-
方法详细资料
-
tryCatch
异常捕获起来- 类型参数:
T- 类型- 参数:
supplier- 要执行的方法- 返回:
- 返回数据
-
format
格式化文本, {} 表示占位符
此方法只是简单将占位符 {} 按照顺序替换为参数
如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
例:
// 通常使用 -> 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- 参数值- 返回:
- 格式化后的文本
-
nextInt
public static int nextInt(int bound) 随机整数 [0,bound)- 参数:
bound- 最大- 返回:
- 整数
-