Re: Uper/lower case

 BBS: Inland Empire Archive
Date: 12-22-92 (18:58)             Number: 350
From: BOB PERKINS                  Refer#: NONE
  To: DON WOOD                      Recvd: NO  
Subj: Re: Uper/lower case            Conf: (2) Quik_Bas
 DW> Hello there,
 DW>    I'm new to quick basic and I need a routine that will
 DW> allow an input in either uper case or lower case.

  For a simple one-line entry:

  LINE INPUT, Text$       'or one of the variants..

  Will get it in the case it was typed in.  If you want it
in all uppercase you can Text$=UCASE$(Text$) and every
letter will then be capitalized.  LCASE$(Text$) goes the
other direction.

  Or, if you want to have selective input, you can write your own routine:

 Compare$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"    '< Declare our "accept" string
 LOCATE , , 1, 6, 7                         '< Turn cursor on and thicken it
   Text$ = ""
     a$ = INKEY$                            '< Fetches key presses
     IF LEN(a$) THEN                        '< If key pressed continue on
       IF a$ = CHR$(13) THEN EXIT DO        '< if carriage return exit loop
       IF a$ = CHR$(8) AND LEN(Text$) THEN  '< trap for backspace key
         Text$ = LEFT$(Text$, LEN(Text$) - 1)  '< if BS key erase a character
         x% = POS(0) - 1                       '  and then wipe it from the
         LOCATE , x%: PRINT " ";               '  screen and..
         LOCATE , x%                           '  reposition cursor
       END IF
       IF INSTR(Compare$, a$) THEN          '< a$ used if in string Compare$
         Text$ = Text$ + a$                 '< add the character to Text$
         PRINT a$;                          '< print it to the screen
       END IF
     END IF
   PRINT : PRINT Text$

  You can change Compare$ to whatever you want as your allowed characters.
In this example only capital letters from A-Z are accepted
by the input routine.

--- Msg V4.5
 * Origin: Reciprocity Failure  (1:124/4115.236)
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