`
itace
  • 浏览: 178449 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Format

    博客分类:
  • java
 
阅读更多

 

          NumberFormat,DecimalFormat,DateFormat

 

		NumberFormat f = NumberFormat.getInstance();//普通数字
		f.setMinimumIntegerDigits(3);
		f.setMinimumFractionDigits(2);
		f.setMaximumFractionDigits(3);
		System.out.println(f.format(1234456.5));
		
		NumberFormat pf =  NumberFormat.getPercentInstance();//百分号数字
		pf.setMinimumFractionDigits(2);
		System.out.println(pf.format(0.889));

 

0 一个数字 
# 一个数字,不包括首尾多余的 0 
. 小数的分隔符
, 分组分隔符
; 分隔格式
- 缺省负数前缀
% 乘以 100,作为百分比显示 

 

		DecimalFormat df = new DecimalFormat("00.00"); //
		DecimalFormat df2 = new DecimalFormat("##.##"); //
		DecimalFormat df3 = new DecimalFormat("##.##%"); 


		System.out.println(df.format(9.9));//09.90
		System.out.println(df2.format(9.9));//9.9
		System.out.println(df3.format(0.99994));//99.99%

 

 

 

分享到:
评论

相关推荐

    RGBFormat.rar_ARGB format_RGBFormat_RGBformat.8bi_rgbformat插件

    综上所述,"RGBFormat.rar" 包含了一个名为"RGBFormat.8BI"的图像处理插件,这个插件可能支持RGB和ARGB格式,并且内置了曲线拟合的线性最小二乘法,以优化图像处理效果,尤其是对于颜色校正和透明度控制方面。...

    linux 系统clang-format可执行文件,vscode clang-format插件

    Linux系统中的Clang-Format是一个强大的源代码格式化工具,主要应用于C++、C、Objective-C、Objective-C++以及CUDA等编程语言。它遵循特定的编码风格,可以帮助开发者保持代码的一致性和整洁性,这对于团队协作和...

    关于c++的Format函数详解

    关于 C++ 的 Format 函数详解 Format 函数是 C++ 编程语言中的一种格式化字符串的函数,它可以将多个参数格式化成一个字符串。下面是 Format 函数的详解。 Format 函数的声明 Format 函数的声明为:`function ...

    PS CS6输出ICO格式插件(32和64位)ICOFormat64.8bi

    支持PS CS6 64位的ico输出插件 ICOFormat64.8bi 和 ICOFormat.8bi 我们做系统ICO图标时 , 为了美观 , 会使背景透明 , 但是 PS 本身 并没有 ICO 输出格式, 我们可能会用到IconWorkshop来 支持一下输出, 但是有...

    C# 扩展名获得ImageFormat

    根据给定的信息,本文将详细解释如何通过C#编程语言中的扩展名获取图像格式(ImageFormat)的相关知识点。本文首先会介绍扩展名与图像格式的基本概念,随后深入探讨代码实现细节。 ### 扩展名与图像格式简介 在...

    JsonFormat java android

    "JsonFormat"在这里指的是一款本地工具,用于帮助开发者更方便地对JSON数据进行格式化,使其更易读。 在Windows环境下,开发者经常需要处理来自服务器的JSON响应或者在代码中创建JSON字符串。"JsonFormat"这款工具...

    parquet-format-2.3.1-API文档-中英对照版.zip

    赠送jar包:parquet-format-2.3.1.jar; 赠送原API文档:parquet-format-2.3.1-javadoc.jar; 赠送源代码:parquet-format-2.3.1-sources.jar; 赠送Maven依赖信息文件:parquet-format-2.3.1.pom; 包含翻译后的API...

    jackson-dataformat-yaml-2.11.4-API文档-中文版.zip

    赠送jar包:jackson-dataformat-yaml-2.11.4.jar; 赠送原API文档:jackson-dataformat-yaml-2.11.4-javadoc.jar; 赠送源代码:jackson-dataformat-yaml-2.11.4-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    jackson-dataformat-cbor-2.9.6-API文档-中文版.zip

    赠送jar包:jackson-dataformat-cbor-2.9.6.jar; 赠送原API文档:jackson-dataformat-cbor-2.9.6-javadoc.jar; 赠送源代码:jackson-dataformat-cbor-2.9.6-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    jackson-dataformat-yaml-2.11.4-API文档-中英对照版.zip

    赠送jar包:jackson-dataformat-yaml-2.11.4.jar; 赠送原API文档:jackson-dataformat-yaml-2.11.4-javadoc.jar; 赠送源代码:jackson-dataformat-yaml-2.11.4-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    arrow-format-0.8.0-API文档-中文版.zip

    赠送jar包:arrow-format-0.8.0.jar; 赠送原API文档:arrow-format-0.8.0-javadoc.jar; 赠送源代码:arrow-format-0.8.0-sources.jar; 赠送Maven依赖信息文件:arrow-format-0.8.0.pom; 包含翻译后的API文档:...

    WPF中StringFormat的用法

    在Windows Presentation Foundation (WPF) 开发中,`StringFormat` 是一个非常实用的功能,它允许开发者以一种灵活且强大的方式格式化绑定的数据。本文将详细介绍 `StringFormat` 在 WPF 中的应用及其与 C# 中 `...

    jackson-dataformat-cbor-2.9.6-API文档-中英对照版.zip

    赠送jar包:jackson-dataformat-cbor-2.9.6.jar; 赠送原API文档:jackson-dataformat-cbor-2.9.6-javadoc.jar; 赠送源代码:jackson-dataformat-cbor-2.9.6-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    jackson-dataformat-cbor-2.13.1-API文档-中文版.zip

    赠送jar包:jackson-dataformat-cbor-2.13.1.jar 赠送原API文档:jackson-dataformat-cbor-2.13.1-javadoc.jar 赠送源代码:jackson-dataformat-cbor-2.13.1-sources.jar 包含翻译后的API文档:jackson-data...

    jackson-dataformat-yaml-2.10.0-API文档-中文版.zip

    赠送jar包:jackson-dataformat-yaml-2.10.0.jar; 赠送原API文档:jackson-dataformat-yaml-2.10.0-javadoc.jar; 赠送源代码:jackson-dataformat-yaml-2.10.0-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    jackson-dataformat-xml-2.12.2-API文档-中文版.zip

    赠送jar包:jackson-dataformat-xml-2.12.2.jar; 赠送原API文档:jackson-dataformat-xml-2.12.2-javadoc.jar; 赠送源代码:jackson-dataformat-xml-2.12.2-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    ICOFormat64.zip

    ICOFormat64.zip是一个包含64位版本的ICOFormat插件的压缩文件,适用于Adobe Photoshop CS6 64位版本。ICOFormat插件是用于处理图标(ICO)文件格式的专业工具,它允许用户在Photoshop中创建、编辑和保存ICO格式的...

    jackson-dataformat-xml-2.12.2-API文档-中英对照版.zip

    赠送jar包:jackson-dataformat-xml-2.12.2.jar; 赠送原API文档:jackson-dataformat-xml-2.12.2-javadoc.jar; 赠送源代码:jackson-dataformat-xml-2.12.2-sources.jar; 赠送Maven依赖信息文件:jackson-data...

    ISO 9564-1 format 4 tool

    "Format 4" 是其中的一个特定格式,用于加密和解密PIN码,以防止未经授权的访问。 Format 4 在ISO 9564-1中定义了一种高级加密标准(AES),这是目前广泛使用的对称加密算法。AES以其强大的安全性和效率而闻名,...

    VB6-FormatCode.rar_CodeFormat.dll_VB FormatCode_VB6插件_vb6 format

    "VB6-FormatCode.rar"正是这样一款专为VB6定制的代码格式化插件,它内含"CodeFormat.dll"核心组件,能够帮助开发者快速、准确地对VB6代码进行格式化,提高编程效率并确保代码质量。 "VB FormatCode"是这个插件的...

Global site tag (gtag.js) - Google Analytics