'===========================================================================
' Subject: LENGTH EXAMPLE                     Date: Unknown Date (00:00)   
'  Author: Jeff Shantz                        Code: QB, QBasic, PDS        
'  Origin: LENGTH,EXAMPLE                   Packet: TEXT.ABC
'===========================================================================
'Length Example By Jeff Shantz
'
'Programmer's Note
'
'This Examples Demonstrates The Use Of The Length Of Characters In
'QuickBasic.  It Can Be Used For Any Sort Of Program And Is A Very Useful
'Command.  This Program Uses 2 Main Commands, LEN And STR$.  LEN Is The
'Length Of Whatever Variable Is In The Parentheses That Accompany It.
'STR$ Is Merely Changing The Variable That Is In Parentheses Beside It,
'To The Variable STR$.  These Commands Can Be Useful For Games, Utilities,
'And Many Other Programs. 
'
'
'Titles And Instructions
0 CLS : LOCATE 1, 30: COLOR 4: PRINT "Length Example"
LOCATE 3, 20: COLOR 7: PRINT "Enter On Blank Line Or `0' To Quit"
LOCATE 7, 5: INPUT "Type A Number Ranging From 1-7 Digits : ", N
IF N < 1 THEN SYSTEM     'if the input is lower than 1, program exits
'in the statement below, if the input is higher than 7 digits, too high

IF LEN(STR$(N)) > 8 THEN PRINT "Too High!": SLEEP 1: GOTO 0
ON LEN(STR$(N)) GOTO 1   'if it receives valid input, goes to label 1
'the statement below returns the number of digits that were inputted
1 LOCATE 9, 20: PRINT "You Typed A"; LEN(STR$(N)) - 1; "Digit Number":
PRINT : SLEEP 1: GOTO 0  'returns to 0

'Written by Jeff Shantz
'
'A catalogue of other public domain programming examples and other types of
'public domain software written by Jeff Shantz can be obtained by sending
'$2.00 (for shipping & handling) to:
'
'Programming Examples
'c/o Jeff Shantz
'162 Ann Street
'Kitchener,Ontario
'N2B 1Y3, CANADA
'
'or by setting your modem to 8,N,1 and calling The Crypt at 1-(519)-576-3127


