<-- Previous || Up || Next -->

Strip VB Comments Function
String Extras Class

Public Function StripVBComments( _
      ByVal vLine As Variant _
    , Optional ByVal vKeepCopyrights As Variant _
    ) As Variant

"Strip Visual Basic Comments"
Strip the comments from a string representing a line of Visual Basic code.
Returns a string containing everything but the comment portion of a line of Visual Basic source code.

Top20: This function is among our "top-twenty" most useful.
    StripVBComments("    ' Assignment.") = "    "
    StripVBComments("    lngNum = 45 ' Assignment.") = "    lngNum = 45 "
    StripVBComments("    lngNum = 45") = "    lngNum = 45"
    StripVBComments("    ' Copyright Entisoft") = "    "
    StripVBComments("    ' Copyright Entisoft", True) = "    ' Copyright Entisoft"
See also:
    StripVBCommentsSample Subroutine
    VBObjectBrowserInfoRemove Function
    KeepVBComments Function
vLine: The string containing a line of Visual Basic source code. Function returns Null if vLine is Null or cannot be fixed up to a String.

vKeepCopyrights: Determine whether comments containing copyright notices should be retained. If True, then any comments containing the strings "(C)", "Copr", and "Copyright" will be retained. vKeepCopyrights defaults to False if it is missing or Null or cannot be fixed up to a number.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.