今天碰到个需求,根据字段个数,动态生成sql的占位符,如下: public static void main(String[] args) { System.out.println(String.join(",",Collections.nCopies(10,"?"))); } 显示结果: 来个实际的例子: public class Test { public static void main(String[] args) { String tableName =…
java.text.MessageFormat格式化字符串时的小技巧 public static void main(String[] args) throws InterruptedException { MessageFormat form = new MessageFormat( "{2,date,yyyy-MM-dd HH:mm:ss.SSS} The disk \"{1}\" contains {0,number,#.##} file(s).{3}");…