SByte.TryParse tries to convert string to SByte equivalent : SByte « Data Types « VB.Net






SByte.TryParse tries to convert string to SByte equivalent

 

Module Example
   Public Sub Main()
        Dim numericStrings() As String = {"-3.6", "12.8", "+16.7", "    3   ", _
                                          "(17)", "-17", "+12", "18-", "987", _
                                          "1,024", "  127 "}
        Dim number As SByte
        For Each numericString As String In numericStrings
           If SByte.TryParse(numericString, number) Then
              Console.WriteLine("Converted '{0}' to {1}.", numericString, number)
           Else
              Console.WriteLine("Cannot convert '{0}' to an SByte.", numericString)
           End If      
        Next

    End Sub
End Module

   
  








Related examples in the same category

1.Use the Sign(SByte) method to determine the sign of a SByte value and display it to the console.
2.SByte.MaxValue represents the largest possible value of SByte.
3.SByte.Parse converts string number to 8-bit signed integer.
4.SByte.Parse converts string in a culture-specific format to its 8-bit signed integer
5.SByte.Parse converts string in a style to 8-bit signed integer equivalent.
6.SByte.Parse Method converts string is in a style and culture-specific format to 8-bit signed equivalent.
7.SByte.ToString converts its string using the specified culture-specific format information.
8.SByte.ToString converts to string representation using the specified format.
9.SByte.ToString Method converts to string using the specified format and culture-specific format information.
10.SByte.TryParse tries to convert string in a style and culture-specific format to SByte
11.Assign SByte to Integer