       ͻ
        Lesson 6 Part 140  F-PC 3.5 Tutorial by Jack Brown 
       ͼ

ķ
 Problem 6.16  
Ľ
Test the Simple String Package and capture the output in a file.

( Sample of the string operations )
DECIMAL  ( Set system base to decimal )

( Create a string ALPHA with a maximum length of 50 )
50 STRING ALPHA
( Create a string BETA  with a maximum length of 25 )
25 STRING BETA

( Store the literal string NOW IS THE TIME in BETA )
" NOW IS THE TIME" BETA S!

( Output the contents of BETA )
BETA TYPE

( Print the current and maximum length of BETA )
BETA LEN .
BETA MLEN .

( Output sub string of BETA, characters 5 thru 10 )
5 10 BETA MID$ TYPE

( Replace sub string IS with sub string AT in the string BETA )
" AT" 5 6 BETA MID$ SUB!

( Output changed contents of BETA )
BETA TYPE

( Store sub string of characters 1 thru 6 of BETA into ALPHA )
6 BETA LEFT$ ALPHA S!

( Output ALPHA )
ALPHA TYPE

( Output rightmost 5 characters of ALPHA )
5 ALPHA RIGHT$ TYPE

( Concatenate BETA and ALPHA and store result in ALPHA )
BETA ALPHA S+ ALPHA S!

( Display the result )
ALPHA TYPE

( New data for BETA )
" 12345" BETA S!

( Convert string BETA to a number )
BETA VAL .

( Convert number to a string )
4321 STR$ BETA S!

( Output BETA )
BETA TYPE

( Create a string array of 5 strings of 10 characters each )
5 10 SARRAY NAME

( Store some name in the array )
" Jack " 1 NAME S!
" John " 3 NAME S!

( Display them )
1 NAME TYPE  3 NAME TYPE

( Now try this )
1 NAME 3 NAME S+ 2 NAME S!  2 NAME TYPE

( You are on your own! )

Ŀ
   Please Move to Lesson 6 Part 150  


