Convert Integer to String: D3, N1, X2, X8
Imports System
Imports Microsoft.VisualBasic
Module MainClass
Sub Main( )
Dim numbers() As Integer = { -9999, 0, 999, 99999 }
For Each number As Integer In numbers
Console.Write("{0,-8} --> ", number.ToString())
Console.Write("{0,11:D3}", number)
Console.Write("{0,13:N1}", number)
Console.Write("{0,12:X2}", number)
Console.WriteLine("{0,14:X8}", number)
Next
End Sub
End Module
Related examples in the same category