• Spring字符串占位符替换
import org.springframework.util.PropertyPlaceholderHelper;

import java.util.Properties;

public class PlaceholderUtil {
    private static PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
            "#{", "}", ":", false);

    public static String replacePlaceholders(String value, final Properties properties) {
       return helper.replacePlaceholders(value, properties);
    }

}
  •  String字符串替换(日期/数字等)
String time = String.format("%tc", date);
  • slfj  MessageFormatter
Object[] valueArr= {"aaa", 123};
MessageFormatter.arrayFormat("str {} int {}", valueArr).getMessage();

// {} 定位变量位置
// \{} 表示 跳过该对括号
// 前面再加 \ 则取消跳过

 

相关文章:

  • 2021-10-11
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
猜你喜欢
  • 2021-06-08
  • 2022-12-23
  • 2021-09-05
  • 2021-11-17
  • 2021-09-28
  • 2022-12-23
  • 2021-09-22
相关资源
相似解决方案