Translation table example

 BBS: Inland Empire Archive
Date: 05-26-92 (11:27)             Number: 179
From: CORIDON HENSHAW              Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Translation table example      Conf: (2) Quik_Bas
For anyone who would like a translation table example, I've
got a compleat one, here it is:

---Cut Here---

DEFINT A-Z

COLOR 14, 1
CLS
RESTORE
DIM CharTable(255) AS STRING * 3

FOR X = 65 TO 116 + 6
        READ CharTable(X)
NEXT

LINE INPUT "Enter Source File: ", Source$
LINE INPUT "Enter Target File: ", Target$

OPEN Source$ FOR BINARY ACCESS READ LOCK WRITE AS #1
OPEN Target$ FOR BINARY ACCESS WRITE LOCK READ AS #2

Length@ = LOF(1)
Start@ = TIMER

CLS
PRINT "Char number:         of:         InChar:   OutChar:"
LOCATE 1, 25
PRINT Length@;
FOR Total@ = 1 TO LOF(1)
        SEEK 1, Total@
        InChar$ = INPUT$(1, 1)
        IF ASC(InChar$) < 65 OR ASC(InChar$) > 122 THEN
                OutChar$ = InChar$
        ELSE
                OutChar$ = RTRIM$(LTRIM$(CharTable(ASC(InChar$))))
        END IF
        LOCATE 1, 13
        PRINT Total@;
        LOCATE 1, 42
        PRINT InChar$
        LOCATE 1, 53
        PRINT OutChar$ + "  "

        PUT #2, , OutChar$
        IF INKEY$ = "q" OR INKEY$ = "Q" THEN EXIT FOR
NEXT
PRINT "Done - took "; RTRIM$(LTRIM$(STR$(TIMER - Start@))); " Seconds"
CLOSE

DATA ,,,D,,F,G,ô,,,K,,M,,,P,Q,R,$,,,V,W,X,Y,Z
DATA [,\,],^,_,`
DATA ,b,,d,,f,g,ÿ,,j,k,,m,,,p,q,r,s,,u,v,w,x,,z
---Cut Here---
>>>>>>>>>>>>>>>>>>>>>>DO NOT REMOVE THE UPPER ORDER
>>>>>>>>>>ASCII!<<<<<<<<<<<<<<<<<<<<< I've only done this to change A-
>>>>>>>>>>z, but it's easy to modify to handle all 255 chars.

--- msgedsq 2.0.5
 * Origin: -=- Point Blank -=- Support Fidonet Reform -=- (1:250/804.200)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET