Home Page


BASIC Handbook

Basic2 Commands
Disk Drives
PEEK's and POKE's
RAM Memory Map
ROM Memory Map
Screen Display
Sprite
ASCII and CHR$ Codes

eMail
email5-commodorecheetah.co.uk

Note: You will need to replace the '-' with the @ symbol.
This is to minimize spam.

My BASIC Quick Reference Guide

MID$
Abbreviation: M <SHIFT+I>

TYPE: String Function
FORMAT: MID$(<string>,<numeric-1>[,<numeric-2>])

Action: The MID$ function returns a sub-string which is taken from within a larger <string> argument. The starting position of the substring is defined by the <numeric-1> argument and the length of the sub-string by the <numeric-2> argument. Both of the numeric arguments can have values ranging from 0 to 255.

If the <numeric-1> value is greater than the length of the <string>, or if the <numeric-2> value is zero, then MID$ gives a null string value. If the <numeric-2> argument is left out, then the computer will assume that a length of the rest of the string is to be used. And if the source string has fewer characters than <numeric-2>, from the starting position to the end of the string argument, then the whole rest of the string is used.

EXAMPLE of MID$ Function:

10 A$="GOOD"
20 B$="MORNING EVENING AFTERNOON"
30 PRINT A$ + MID$(B$,8,8)

GOOD EVENING


Commodore Cheetah made by Allen Monks, started in the year 2000.