Convert numeric string to SByte with a format provider. : Convert « Development « VB.Net






Convert numeric string to SByte with a format provider.

  

Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Module ToSByteProviderDemo
    Sub ConvertToSByte( numericStr As String,provider As IFormatProvider )
        Dim providerValue   As Object

        Try
            providerValue = Convert.ToSByte( numericStr, provider )
        Catch ex As Exception
            Console.WriteLine( ex )
        End Try

        Console.WriteLine( providerValue )
    End Sub

    Sub Main( )
        Dim provider  As NumberFormatInfo = new NumberFormatInfo( )
        provider.NegativeSign = "neg "
        provider.PositiveSign = "pos "
        provider.NumberDecimalSeparator = "."
        provider.NumberNegativePattern = 0

        ConvertToSByte( "123", provider )
    End Sub 
End Module 

   
    
  








Related examples in the same category

1.Convert.ChangeType
2.Convert numeric string to SByte without a format provider
3.Converting strings to numbers in base
4.Convert.ToBase64CharArray converts 8-bit unsigned integer array to Unicode character array
5.Convert the Char array back to a Byte array
6.Convert.ToBase64String converts 8-bit unsigned integers to string encoded with base-64 digits.
7.Convert string by different base
8.Convert.ToDateTime (Object) converts object to a DateTime object.
9.Convert.ToDateTime Method (Object, IFormatProvider) converts object to DateTime using culture-specific format
10.Convert.ToDateTime(String) converts string to date and time value.
11.Convert.ToDateTime(String, IFormatProvider) converts string to date and time, using culture-specific format
12.Convert single value to decimal
13.Convert hex string to Int16
14.Convert hex string to int64
15.Convert Long to Integer
16.Convert double to Integer
17.Convert BigInteger to Integer
18.Convert decimal to Integer