Java 实例 - 字符串格式化

Java 教程 · 2019-02-10 09:29:23

以下实例演示了通过 format() 方法来格式化字符串,还可以指定地区来格式化:

StringFormat.java 文件

import java.util.*; public class StringFormat { public static void main(String[] args){ double e = Math.E; System.out.format("%f%n", e); System.out.format(Locale.CHINA , "%-10.4f%n%n", e); //指定本地为中国(CHINA) } }

以上代码实例输出结果为:

2.718282
2.7183  

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

Data Structures and Algorithms in Python

Data Structures and Algorithms in Python

Michael T. Goodrich、Roberto Tamassia、Michael H. Goldwasser / John Wiley & Sons / 2013-7-5 / GBP 121.23

Based on the authors' market leading data structures books in Java and C++, this book offers a comprehensive, definitive introduction to data structures in Python by authoritative authors. Data Struct......一起来看看 《Data Structures and Algorithms in Python》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具