Welcome Notes

Welcome Viewers

08 March 2018

Convert String To Double

Dear All,
   Today , We will see, How to Convert String To Double.



 Public Function ConvertStringToDouble(ByVal str As String) As Double()
        Dim strRight As String = String.Empty
        Dim strSplit() As String = Convert.ToString(str).Split(":")
        Dim strLeft As String = strSplit(0)
        If strSplit.Length = 1 Then
            strRight = "00"
        Else
            strRight = strSplit(1)
        End If
        Dim result(1) As Double
        result(0) = strLeft
        If strRight.Length = 2 Then
            If Not strRight.Contains("00") Then
                result(1) = "." & strRight
            End If
        Else
            result(1) = strRight.Remove(3, 2)
        End If
        Return result
    End Function