博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
格式化字符串,固定宽度字符串,不足用空格填补
阅读量:6868 次
发布时间:2019-06-26

本文共 1096 字,大约阅读时间需要 3 分钟。

using System;using System.Globalization;public class Example{   public static void Main()   {      string[] cultureNames = { "en-US", "fr-FR", "de-DE", "es-ES" };      DateTime dateToDisplay = new DateTime(2009, 9, 1, 18, 32, 0);      double value = 9164.32;      Console.WriteLine("Culture     Date                                Value\n");      foreach (string cultureName in cultureNames)      {         CultureInfo culture = new CultureInfo(cultureName);         string output = String.Format(culture, "{0,-11} {1,-35:D} {2:N}",                                        culture.Name, dateToDisplay, value);         Console.WriteLine(output);      }       }}// The example displays the following output://    Culture     Date                                Value//    //    en-US       Tuesday, September 01, 2009         9,164.32//    fr-FR       mardi 1 septembre 2009              9 164,32//    de-DE       Dienstag, 1. September 2009         9.164,32//    es-ES       martes, 01 de septiembre de 2009    9.164,32

 

本文转自cnn23711151CTO博客,原文链接: http://blog.51cto.com/cnn237111/569009,如需转载请自行联系原作者

你可能感兴趣的文章
Skype For Business online混合部署(二)--混合部署配置
查看>>
Dojo AMD介绍
查看>>
Rsync忽略文件夹或目录
查看>>
linux基础命令Ⅱ
查看>>
Linux下阻塞与非阻塞IO
查看>>
centos6-7 yum安装php的方法
查看>>
No result defined for action
查看>>
Linux下批量管理工具PSSH
查看>>
打印hibernate的SQL语句的几种办法
查看>>
nginx 高级配置示例.
查看>>
HTML知识点笔记(持续添加+++++++)
查看>>
忘记了root密码怎么办
查看>>
Tomcat 警告:consider increasing the maximum size of the cache
查看>>
Linux 用户,组,权限小练习
查看>>
DNS服务在网络中的应用
查看>>
大步迈入3G 时代,如何选择性价比高的资费呢?
查看>>
iPhone异常关机怎么解决?中国消费者协会请苹果10日内答复
查看>>
Sbo通用数据选择功能的实现
查看>>
Oracle 快照控制文件(snapshot control file)
查看>>
11家小微贷机构签约费埃哲云平台 提升P2P风险管理
查看>>