Hi
Here is one way to do it.
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim s As String = "22.55%"
' here, a valid Decimal numeric value
' is available (0 if string was not
' a valid Decimal)
Dim dec As Decimal = GetPercent(s)
Stop
End Sub
Function GetPercent(s As String) As Decimal
Dim ss As String = s.Replace("%"c, String.Empty)
Dim v As Decimal = 0.0D
If Decimal.TryParse(ss, v) Then
Return v
End If
' if the string can not be converted to
' a valid Decimal then it will return 0
Return 0.0D
End Function
End Class