'//去掉源代码中的“//”注释语句
Public Function cliearAnnotation(strCode As String) As String
Dim arr, a As Integer, strFront As String
arr = Split(strCode, vbCrLf)
For a = 0 To UBound(arr)
If InStr(arr(a), "//") Then
'//检测//前面是否有字符
strFront = Split(arr(a), "//")(0)
strFront = Replace(strFront, " ", "")
strFront = Replace(strFront, vbTab, "")
If Len(strFront) = 0 Then '如果//前没有字符
strCode = Replace(strCode, arr(a), "")
End If
End If
Next a
cliearAnnotation = strCode
' VB.Clipboard.Clear
' VB.Clipboard.SetText cliearAnnotation
End Function
只能去掉前面"//"前面的内容,
如//ssssss
不能去掉在代码未的内容
如:dim a as string //sssss这样保持不变