56 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
57 createAsciiTable()
58 End Sub
59
60 Function createRow(ByVal hexValue As String, ByVal byteValue As String) As String
61 Return ("<tr><td>" & byteValue & "</td><td>" & hexValue & "</td>" & _
62 "<td>" & Chr(byteValue) & "</td><td>\x" & hexValue & "</td></tr>")
63 End Function
64
65 Sub createAsciiTable()
66 Dim str As New List(Of String)
67 For i = 0 To 9
68 For j = 0 To 9
69 Dim hexValue As String = i & j
70 Dim byteValue = Byte.Parse(hexValue.Chars(0) & hexValue.Chars(1), _
71 Globalization.NumberStyles.HexNumber)
72
73 str.Add(createRow(hexValue, byteValue))
74
75 If j = 9 Then
76 For k As Integer = 97 To 102
77 hexValue = i & "" & Chr(k)
78 byteValue = Byte.Parse(hexValue.Chars(0) & hexValue.Chars(1), _
79 Globalization.NumberStyles.HexNumber)
80
81 str.Add(createRow(hexValue, byteValue))
82 Next
83 End If
84 Next
85 Next
86 For i = 97 To 102
87 For j = 0 To 9
88 Dim hexValue As String = Chr(i) & j
89 Dim byteValue = Byte.Parse(hexValue.Chars(0) & hexValue.Chars(1), _
90 Globalization.NumberStyles.HexNumber)
91
92 str.Add(createRow(hexValue, byteValue))
93
94 If j = 9 Then
95 For k As Integer = 97 To 102
96 hexValue = Chr(i) & "" & Chr(k)
97 byteValue = Byte.Parse(hexValue.Chars(0) & hexValue.Chars(1), _
98 Globalization.NumberStyles.HexNumber)
99
100 str.Add(createRow(hexValue, byteValue))
101
102 Next
103 End If
104 Next
105 Next
106
107 Dim tbl As String = "<style>.myCell{border-collapse:collapse}" & _
108 ".myCell td{border:1px solid #cccccc;" & _
109 "padding:2px;font-family:arial;" & _
110 "font-size:9px}</style>" & vbCrLf & _
111 "<table border=1 width=100%><tr>"
112 For i = 0 To 3
113 tbl &= "<td><table class=""myCell"">" & _
114 "<tr><td>Byte</td><td>Hex</td><td>Ascii</td><td>Escape</td></tr>" & vbCrLf
115 For j = 0 To 63
116 tbl &= str((i * 64) + j) & vbCrLf
117 Next
118 tbl &= "</table></td>"
119 Next
120 tbl &= "</tr></table>"
121
122 Response.Write(tbl)
123 End Sub