Convert.ToChar(String,IFormatProvider) converts the first character of string to a Unicode character with culture format : Convert to Char « Development « VB.Net






Convert.ToChar(String,IFormatProvider) converts the first character of string to a Unicode character with culture format

  


Imports System.Globalization

Public Class DummyProvider
    Implements IFormatProvider

    Public Function GetFormat( argType As Type ) As Object Implements IFormatProvider.GetFormat

        Dim argStr  As String = argType.ToString( )
        If argStr = "" Then argStr = "Empty"
        argStr = argStr.Substring( argStr.LastIndexOf( "."c ) + 1 )

        Console.Write( "{0,-20}", argStr )
        Return Nothing

    End Function 
End Class

Module ConvertNonNumericProviderDemo

    Sub Main( )
        ' Create an instance of IFormatProvider.
        Dim provider    As New DummyProvider( )

        ' Convert these values using DummyProvider.
        Dim Int32A      As String   = "-2"   

        Console.WriteLine( Convert.ToInt32( Int32A, provider ) )
    End Sub
End Module

   
    
  








Related examples in the same category

1.Convert.ToChar (Byte) converts 8-bit unsigned integer to Unicode character.
2.Convert.ToChar (Int16) converts 16-bit signed integer to Unicode character.
3.Convert.ToChar (Int32) converts 32-bit signed integer to Unicode character.
4.Convert.ToChar (Int64) converts 64-bit signed integer to Unicode character.
5.Convert.ToChar (Object) converts object to a Unicode character.
6.Convert.ToChar (SByte) converts 8-bit signed integer to Unicode character.
7.Convert.ToChar (String) converts the first character of a string to a Unicode character.
8.Convert.ToChar (UInt16) converts 16-bit unsigned integer to Unicode character.
9.Convert.ToChar (UInt32) converts 32-bit unsigned integer to Unicode character.
10.Convert.ToChar (UInt64) converts 64-bit unsigned integer to Unicode character.