当前位置: 首页>>代码示例>>VB.NET>>正文


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

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


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

示例1: numbers

Dim numbers() As Short = {-23092, 0, 14894, Int16.MaxValue}
Dim providers() As CultureInfo = {New CultureInfo("en-us"), _
                                  New CultureInfo("fr-fr"), _
                                  New CultureInfo("de-de"), _
                                  New CultureInfo("es-es")}
For Each int16Value As Short In Numbers
   For Each provider As CultureInfo In providers
      Console.Write("{0, 6} ({1})     ", _
                    int16Value.ToString(provider), _
                    provider.Name)
   Next                     
   Console.WriteLine()
Next
开发者ID:VB.NET开发者,项目名称:System,代码行数:13,代码来源:Int16.ToString

输出:

-23092 (en-US)     -23092 (fr-FR)     -23092 (de-DE)     -23092 (es-ES)
0 (en-US)          0 (fr-FR)          0 (de-DE)          0 (es-ES)
14894 (en-US)      14894 (fr-FR)      14894 (de-DE)      14894 (es-ES)
32767 (en-US)      32767 (fr-FR)      32767 (de-DE)      32767 (es-ES)

示例2: formats

Dim value As Int16 = 14603
Dim formats() As String = {"C", "D6", "e1", "E2", "F1", "G", "N1", _
                           "P0", "X4", "000000.0000", "##000.0"}
Dim providers() As CultureInfo = {New CultureInfo("en-us"), _
                                  New CultureInfo("fr-fr"), _
                                  New CultureInfo("de-de"), _
                                  New CultureInfo("es-es")}
' Display header.
Console.WriteLine("{0,24}{1,14}{2,14}{3,14}", providers(0), providers(1), _
                  providers(2), providers(3))
Console.WriteLine()                        
' Display a value using each format string.
For Each format As String In formats
   ' Display the value for each provider on the same line.
   Console.Write("{0,-12}", format)
   For Each provider As CultureInfo In providers
      Console.Write("{0,12}  ", _
                    value.ToString(format, provider)) 
   Next
   Console.WriteLine()
Next
开发者ID:VB.NET开发者,项目名称:System,代码行数:21,代码来源:Int16.ToString

输出:

en-US         fr-FR         de-DE         es-ES

C             $14,603.00   14 603,00 €   14.603,00 €   14.603,00 €  
D6                014603        014603        014603        014603  
e1              1.5e+004      1,5e+004      1,5e+004      1,5e+004  
E2             1.46E+004     1,46E+004     1,46E+004     1,46E+004  
F1               14603.0       14603,0       14603,0       14603,0  
G                  14603         14603         14603         14603  
N1              14,603.0      14 603,0      14.603,0      14.603,0  
P0           1,460,300 %   1 460 300 %    1.460.300%   1.460.300 %  
X4                  390B          390B          390B          390B  
000000.0000  014603.0000   014603,0000   014603,0000   014603,0000  
##000.0          14603.0       14603,0       14603,0       14603,0

示例3: values

Dim values() As Int16 = {-23805, 32194}
Dim formats() As String = {"C4", "D6", "e1", "E2", "F1", "G", "N1", _
                           "P0", "X4", "000000.0000", "##000.0"}
For Each format As String In formats
   Console.WriteLine("'{0,2}' format specifier: {1,17}   {2,17}", _ 
                     format, _
                     values(0).ToString(format), _
                     values(1).ToString(format))
Next
开发者ID:VB.NET开发者,项目名称:System,代码行数:9,代码来源:Int16.ToString

输出:

C4' format specifier:    ($23,805.0000)        $32,194.0000
D6' format specifier:           -023805              032194
e1' format specifier:         -2.4e+004            3.2e+004
E2' format specifier:        -2.38E+004           3.22E+004
F1' format specifier:          -23805.0             32194.0
G' format specifier:            -23805               32194
N1' format specifier:         -23,805.0            32,194.0
P0' format specifier:      -2,380,500 %         3,219,400 %
X4' format specifier:              A303                7DC2
000000.0000' format specifier:      -023805.0000         032194.0000
##000.0' format specifier:          -23805.0             32194.0

示例4: numbers

Dim numbers() As Short = {0, 14624, 13982, Short.MaxValue, _
                         Short.MinValue, -16667}
For Each number As Short In numbers
   Console.WriteLine(number.ToString())
Next
开发者ID:VB.NET开发者,项目名称:System,代码行数:5,代码来源:Int16.ToString

输出:

0
14624
13982
32767
-32768
-16667


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