BBS: Inland Empire Archive Date: 02-15-93 (00:43) Number: 381 From: LEE HERRON Refer#: NONE To: ALL Recvd: NO Subj: GETNPUT.BAS 1/3 Conf: (2) Quik_Bas
Hello All! A little bit of code I have found useful over the months (I haven't been doing this long) '*************************************************************************** '* GETNPUT.BAS (from Lee Herron's kindergarden scrapbook) * '* * '* This is a simple routine, nasty and not well commented, but one that * '* gets the job done. GETNPUT covers all the input needs I have run * '* accross from time to time. It will limit the input to numbers, all * '* UPPER case, 1st letter uppercase, NO spaces, convert spaces to under * '* scores for records, use defaults, add MACROs, and format input. * '* * '* Like I said, it is nasty, I would like to see a clean version but I * '* have never been interested it doing it myself, if you do, please send * '* me a copy at 1:3612/130fido. * '* * '* ====================================================================== * '* GETNPUT (p$, d$, st$, u#, n#, a#) * '* d$ = the pattern used, ie: "00/00/00" * '* p$ = Default * '* st$ = blank input charactor ie: 00/00/00 would be: "0" * '* u# = 1st charactor uppercase * '* n# = No spaces * '* a# = All uppercase/numbers only (1=All uppercase 2=Only numbers) * '*************************************************************************** DECLARE SUB getinput (p$, d$, st$, u#, n#, a#) DEFINT A-Z CLS COLOR 15, 1 ' ---[* Creating a date default p$ = LEFT$(DATE$, 2) + "/" + MID$(DATE$, 4, 2) + "/" + RIGHT$(DATE$, 2) d$ = " / / ": st$ = " " ' ---[* Massive bordom! ban$ = "#$%&'()*+,-./0123456^]mhkqqLaatBCDEFĦIv ĦP}" ban1$ = ban$ + "T}İŞ¨¨[\]^_`abcdefghijklmn}zr" FOR c = 1 TO LEN(ban1$) wrk$ = MID$(ban1$, c, 1) unenc$ = unenc$ + CHR$(ASC(wrk$) - c - 2) NEXT c ' ---[* A few simple samples PRINT unenc$: LOCATE 6 COLOR 15, 0: PRINT "This is an example of using the " PRINT "formated command with a default: "; COLOR 15, 4: getinput p$, d$, st$, 0, 0, 0: COLOR 15, 1: PRINT "You entered: "; i$ COLOR 15, 0 p$ = "": d$ = SPACE$(10): st$ = "" PRINT : PRINT "This is an example of using the " PRINT "Upper Case 1st letter option: "; COLOR 15, 4: getinput p$, d$, st$, 1, 0, 0: COLOR 15, 1: PRINT "You entered: "; i$ COLOR , 0: PRINT : PRINT "This is an example of using the Number only," PRINT "No space option w/pattern: "; COLOR 15, 4: getinput "", "( ) - ", st$, 1, 1, 2: COLOR 15, 1: PRINT "You entered: "; i$ ' ---[* More Massive bordom! endb1$ = "&VzrqtzG.]yxzZ~mz'JK]+\r|???qtuA6]Q&8>7" Encd$ = endb1$ + "B+P`.7IAF<HNJD>=:9)2<F@D@B@CFD>6" e = 5 FOR c = 1 TO LEN(Encd$) wrk$ = MID$(Encd$, c, 1) e = e + 1 IF e = 24 THEN e = 5: UNEncd$ = UNEncd$ + CHR$(ASC(wrk$) - e) NEXT c '------------------8<---------- SNIP --------------8<----------------------- 'END PART I --- GoldED 2.40 * Origin: NightFlight BBS [16.8 HST-DS] (1:3612/130)
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