• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

VB.NET UInt64.ToString方法代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了VB.NET中System.UInt64.ToString方法的典型用法代码示例。如果您正苦于以下问题:VB.NET UInt64.ToString方法的具体用法?VB.NET UInt64.ToString怎么用?VB.NET UInt64.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。



在下文中一共展示了UInt64.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。

示例1: Example

' 导入命名空间
Imports System.Globalization

Module Example
   Public Sub Main()
      ' Define an array of CultureInfo objects.
      Dim ci() As CultureInfo = { New CultureInfo("en-US"), _
                                  New CultureInfo("fr-FR"), _
                                  CultureInfo.InvariantCulture } 
      Dim value As ULong = 18709243
      Console.WriteLine("  {0,12}   {1,12}   {2,12}", _
                        GetName(ci(0)), GetName(ci(1)), GetName(ci(2))) 
      Console.WriteLine("  {0,12}   {1,12}   {2,12}", _
                        value.ToString(ci(0)), value.ToString(ci(1)), value.ToString(ci(2)))            
      
   End Sub
   
   Private Function GetName(ci As CultureInfo) As String
      If ci.Equals(CultureInfo.InvariantCulture) Then
         Return "Invariant"
      Else
         Return ci.Name
      End If   
   End Function
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:25,代码来源:UInt64.ToString

输出:

en-US          fr-FR      Invariant
18709243       18709243       18709243


示例2: Example

' 导入命名空间
Imports System.Globalization

Module Example
   Public Sub Main()
      ' Define cultures whose formatting conventions are to be used.
      Dim cultures() As CultureInfo = {CultureInfo.CreateSpecificCulture("en-US"), _
                                       CultureInfo.CreateSpecificCulture("fr-FR"), _
                                       CultureInfo.CreateSpecificCulture("es-ES") }
      Dim specifiers() As String = {"G", "C", "D4", "E2", "F", "N", "P", "X2"} 
      Dim value As ULong = 22224021
      
      For Each specifier As String In specifiers
         For Each culture As CultureInfo In Cultures
            Console.WriteLine("{0,2} format using {1} culture: {2, 18}", _ 
                              specifier, culture.Name, _
                              value.ToString(specifier, culture))

         Next
         Console.WriteLine()
      Next
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:23,代码来源:UInt64.ToString

输出:

G format using en-US culture:           22224021
G format using fr-FR culture:           22224021
G format using es-ES culture:           22224021

C format using en-US culture:     $22,224,021.00
C format using fr-FR culture:    22 224 021,00 ?
C format using es-ES culture:    22.224.021,00 ?

D4 format using en-US culture:           22224021
D4 format using fr-FR culture:           22224021
D4 format using es-ES culture:           22224021

E2 format using en-US culture:          2.22E+007
E2 format using fr-FR culture:          2,22E+007
E2 format using es-ES culture:          2,22E+007

F format using en-US culture:        22224021.00
F format using fr-FR culture:        22224021,00
F format using es-ES culture:        22224021,00

N format using en-US culture:      22,224,021.00
N format using fr-FR culture:      22 224 021,00
N format using es-ES culture:      22.224.021,00

P format using en-US culture: 2,222,402,100.00 %
P format using fr-FR culture: 2 222 402 100,00 %
P format using es-ES culture: 2.222.402.100,00 %

X2 format using en-US culture:            1531C95
X2 format using fr-FR culture:            1531C95
X2 format using es-ES culture:            1531C95


示例3: Example

' 导入命名空间
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim value As ULong = 217960834 
      Dim specifiers() As String = { "G", "C", "D3", "E2", "e3", "F", _
                                     "N", "P", "X", "000000.0", "#.0", _
                                     "00000000;(0);**Zero**" }
      
      For Each specifier As String In specifiers
         Console.WriteLine("{0}: {1}", specifier, value.ToString(specifier))
      Next
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:15,代码来源:UInt64.ToString

输出:

G: 217960834
C: $217,960,834.00
D3: 217960834
E2: 2.18E+008
e3: 2.180e+008
F: 217960834.00
N: 217,960,834.00
P: 21,796,083,400.00 %
X: CFDD182
000000.0: 217960834.0
#.0: 217960834.0
00000000;(0);**Zero**: 217960834


示例4: Example

Module Example
   Public Sub Main()
      Dim value As ULong = 163249057
      ' Display value using default ToString method.
      Console.WriteLine(value.ToString())            
      Console.WriteLine()
      
      ' Define an array of format specifiers.
      Dim formats() As String = { "G", "C", "D", "F", "N", "X" }
      ' Display value using the standard format specifiers.
      For Each format As String In formats
         Console.WriteLine("{0} format specifier: {1,16}", _
                           format, value.ToString(format))         
      Next
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:16,代码来源:UInt64.ToString

输出:

163249057

G format specifier:        163249057
C format specifier:  $163,249,057.00
D format specifier:        163249057
F format specifier:     163249057.00
N format specifier:   163,249,057.00
X format specifier:          9BAFBA1



注:本文中的System.UInt64.ToString方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
VB.NET UInt64.TryParse方法代码示例发布时间:2022-05-24
下一篇:
VB.NET UInt32.TryParse方法代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap