Signature (Visual Basic / VBA)
Public Function GetVBToken( _
ByRef rLine As String _
) As String
Code Example
Assuming
Dim strCode As String
strCode = "strSample = 45"
For example
GetVBToken(strCode) = "strSample"
leaves
strCode = "= 45"
Parameters
| Parameter | Description |
|---|---|
| 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. |
Notes & Version History
| Future | Need to consider returning a code describing the type of the unit retrieved. |
| Future | Need to handle numeric constants differently and separately from strings. |
| Note | Function uses the built-in character classification routines to determine which characters are alphanumeric. |
| 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. |