Looking for the function to convert 8.5% to .085
Printable View
Looking for the function to convert 8.5% to .085
Text = "8.5%" without the quotes?
strip the % off, convert to a decimal, and divide by 100.
-tg
Code:Dim s As String = "8.5%"
Dim d As Decimal
If s.Contains("%") Then
s = s.Replace("%", "")
End If
If Decimal.TryParse(s.Trim, d) Then
'good number, convert percent to decimal
d = d / 100
End If