RIAS
asked on
Performance enhancement of a vb.net function
Hi,
Is there a better way of writing this function for speed enhancement.I am using visual studio 2005.
Cheers
Is there a better way of writing this function for speed enhancement.I am using visual studio 2005.
Cheers
Public Function CleanSQL(ByVal SQL As String)
If SQL = String.Empty Then
Return String.Empty
Exit Function
End If
SQL = SQL.Trim
If SQL.StartsWith("'") Then Return String.Empty
If SQL.StartsWith("--") Then Return String.Empty
If SQL.EndsWith(";") Then SQL = SQL.Remove(SQL.Length - 1, 1)
If SQL.ToUpper.EndsWith("GO") Then SQL = SQL.Remove(SQL.Length - 2, 2)
SQL = SQL.Trim
If SQL = vbNewLine Then Return String.Empty
If SQL.StartsWith(Chr(13)) Then SQL = SQL.Substring(1)
If SQL.StartsWith(vbNewLine) Then SQL = SQL.Substring(1)
If SQL.StartsWith(Chr(8)) Then SQL = SQL.Substring(1)
If SQL.StartsWith(Chr(9)) Then SQL = SQL.Substring(1)
If SQL.StartsWith(Chr(10)) Then SQL = SQL.Substring(1)
Return SQL.Trim
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers mate!!
Glad to help :-)
ASKER
StartsWith,EndsWith,SQL.Re
etc.
Cheers