格式化的几种用法

Posted 姩澕

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了格式化的几种用法相关的知识,希望对你有一定的参考价值。

String.format详情参考地址

public class FormatWay {
   static final String detail_url = "http://www.example.com?local={0}";
    public static void main(String[] args) {
        String val = String.format("%s:%s", "hello", "world");
        String detailUrl = MessageFormat.format(detail_url, "hello");
        System.out.println(val);
        System.out.println(detailUrl);

    }
}

以上是关于格式化的几种用法的主要内容,如果未能解决你的问题,请参考以下文章