Public Function GetVBToken( _ ByRef rLine As String _ ) As String
Assuming Dim strCode As String strCode = "strSample = 45" For example GetVBToken(strCode) = "strSample" leaves strCode = "= 45"See also:
GetVBTokenSample Subroutine GetPossiblyQuotedField Function GetToken Function, et. al. GetOpt Function VBAReservedWords PropertyFuture: Need to consider returning a code describing the type of the unit retrieved.
rLine: String containing the Visual Basic code from which the next token will be removed then returned as the value of the function. Function returns an empty string when rLine is an empty string.
This function recognizes the following types of Visual Basic tokens:
Numeric constants and identifiers which are repeated runs of alphanumeric characters.
Comments which begin with a single-quote (') character.
String literals which are enclosed within double-quote (") characters.
Bracketed identifiers such as object names like "[First Name]".
Hexadecimal constants introduced by ampersand (&) characters.
Note: String literals can contain embedded double-quote characters by placing an additional double-quote character (as allowed by Visual Basic), but this function does not remove the extra double-quote character from embedded double-quotes, but it does remove the two double-quote characters which surround the string literal.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.