Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASCII Map

Status
Not open for further replies.

DreXor

Programmer
Jun 17, 2003
2,224
US
dont know how many of you search for an ascii map from time to time, and what specific character codes are what .. like LF and CR and TAB etc, some of us have most of the common ones memorized, yet still have to look things up to occation. i've added this as part of my main functions include file, so it can be called at any time and it generates an optional text file which is nicely viewed in notepad, either directly or via view source

Code:
[green]
' best viewed with notepad with font setting terminal
' OutFile being destination text based file to write char map to, if blank default writes out the file to the webpage (view source)
' function is also set to the output, so you can return from the function and use otherwise.
[/green]
function asciimap(OutFile)
  Special = Split("NULL,SOH (Start of Heading),STX (Start of Text),ETX (End of Text),EOT (End of Transmission),ENQ (Enquiry),ACK (Acknowledge),BEL (Bell),BS (BackSpace),TAB (Tab),LF (Line Feed),VT (Vertical Tab),FF (Form Feed),CR (Carriage Return),SO (Shift Out),SI (Shift In),DLE (Data Link Escape),DC1 (Device Control 1),DC2 (Device Control 2),DC3 (Device Control 3),DC4 (Device Control 4),NAK (Negative Acknowledge),SYN (Syncronous Idle),ETB (End of Transmission Block),CAN (Cancel),EM (End of Medium),SUB (Substitute),ESC (Escape),FS (File Separator),GS (Group Separator),RS (Record Separator),US (Unit Separator),Space",",")

  For i=0 to 255
    Decimal = CStr(i)
    For x=Len(Decimal) to 2
      Decimal = "0" & Decimal
    Next
    If i<=Ubound(special) Then
      If i=9 Then
        OutPut(0) = OutPut(0) & Decimal & CHR(9) & "  [" & Special(i) & "]" & vbcrlf
      Else
        OutPut(0) = OutPut(0) & Decimal & CHR(9) & Chr(i) & " [" & Special(i) & "]" & vbcrlf
      End If
    Else
      OutPut(0) = OutPut(0) & Decimal & CHR(9) & CHR(i) & vbcrlf
    End If
  next

  If OutFile <> "" Then
    Set FS = CreateObject("Scripting.FileSystemObject")
    Set F = FS.CreateTextFile(OutFile,1)

      F.Write OutPut(0)

    F.Close
    Set F = nothing
    Set FS = nothing
  Else
    Response.Write OutPut(0)
  End If
  asciimap = OutPut(0)
End Function


[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top