Here's a fun snippet of "Classic" ASP from our dear old friend, Tim Cartwright. Ignore for the moment that the application stores name/value pairs in the session to be directly be displayed on a following page. Also, ignore that there are potentially enough items in session that the usage of a regular, 16-bit integer would not be enough to index these items. Instead, try to focus on the ever-so-elegant way the author manages to split the session's name/value pairs into a two-dimensional array for further display processing ...
Public Function SessInfo() Dim Item, tmp1, tmp2, a, b, i, ct Dim Stuff() For Each Item In Session.Contents tmp1 = tmp1 & Item & "][" tmp2 = tmp2 & Session(Item) & "][" Next ct = CLng( CLng( Session.Contents.Count ) - 1 ) Redim Stuff(ct, 1) a = split(tmp1, "][") b = split(tmp2, "][") For i = 0 to ubound(a) - 1 Stuff(i, 0) = CStr( a(i) ) Stuff(i, 1) = CStr( b(i) ) Next SessInfo = Stuff End Function
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!