Function Stack Class

StringView

Return a copy of all of the stack items in the form of a string. Return value is prefixed by vPrefix and followed by vSuffix. Stack items are separated by vSeparator in the result string.

Signature (Visual Basic / VBA)

Public Function StringView( _
      Optional ByVal vTopOnLeft As Variant _
    , Optional ByVal vPrefix As Variant _
    , Optional ByVal vSeparator As Variant _
    , Optional ByVal vSuffix As Variant _
    ) As String

Code Example

    Assuming
       Dim stkTemp As New Stack
       stkTemp.PushMulti 1, 22, 333
    for example
       stkTemp.StringView(True)  = "(Top) 333, 22, 1 (Bottom)"
       stkTemp.StringView(False) = "(Bottom) 1, 22, 333 (Top)"

Parameters

Parameter Description
vTopOnLeft True if items are to be added to the string from the top of the stack to the bottom. False if items are to be added to the string from the bottom of the stack to the top. vTopOnLeft defaults to True if it is missing.
vPrefix A string that will be added to beginning of the result string. vPrefix defaults to either "(Top) " or "(Bottom) " (depending upon whether vTopOnLeft is True or False respectively) if it is missing.
vSeparator A string that will separate each of the stack items within the result string. vSeparator defaults to the string ", " if it is missing.
vSuffix A string that will be added to end of the result string. vPrefix defaults to either " (Bottom)" or " (Top)" (depending upon whether vTopOnLeft is True or False respectively) if it is missing.

Notes & Version History

Note Stack items that cannot be converted to strings using the Visual Basic concatenation operator (&) appear as empty strings.
v1.3 BugFix This Function has been fixed to support the viewing of elements from Stacks containing Object and/or DataObject type Values. Any Object type elements will appear in the list as "(Object)" and DataObject type elements will appear in the list as "(DataObject)".
v2.0 Change Changed the arguments to this Function so that they can no longer be Null or of an incompatible data type. They are all still Optional though, so they can be missing, in which case they take on their default value.