0% found this document useful (0 votes)
188 views2 pages

MID$ Function: M X$ NTH

This document provides documentation on the MID$ function in GW-BASIC. It describes the purpose of the MID$ function as returning a string of m characters from string x$ beginning with the nth character. It lists the syntax and comments that n must be within 1-255, m must be within 0-255, and what is returned if m is omitted or out of range. Examples are also provided to demonstrate usage.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views2 pages

MID$ Function: M X$ NTH

This document provides documentation on the MID$ function in GW-BASIC. It describes the purpose of the MID$ function as returning a string of m characters from string x$ beginning with the nth character. It lists the syntax and comments that n must be within 1-255, m must be within 0-255, and what is returned if m is omitted or out of range. Examples are also provided to demonstrate usage.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GW-BASIC User's Guide

MID$ Function
Purpose:
To return a string of m characters from x$ beginning with the nth character.

Syntax:
MID$(x$,n[,m])

Comments:
n must be within the range of 1 to 255.
m must be within the range of 0 to 255.
If m is omitted, or if there are fewer than m characters to the right of n, all rightmost characters
beginning with n are returned.
If n > LEN(x$), MID$ function returns a null string.
If m equals 0, the MID$ function returns a null string.
If either n or m is out of range, an "Illegal function call error" is returned.
For more information and examples, see the LEFT$ and RIGHT$ functions.

Examples:
10 A$="GOOD"
20 B$="MORNING EVENING AFTERNOON"
30 PRINT A$; MID$(B$, 8, 8)
RUN
GOOD EVENING
Line 30 concatenates (joins) the A$ string to another string with a length of eight characters,
beginning at position 8 within the B$ string.

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/MIDSF.html28/03/2004 21.29.34
GW-BASIC User's Guide

RIGHT$ Function
Purpose:
To return the rightmost n characters of string x$.

Syntax:
RIGHT$(x$,n)

Comments:
If n is equal to or greater than LEN(x$), RIGHT$ returns x$. If n equals zero, the null string
(length zero) is returned (see the MID$ and LEFT$ functions).

Examples:
10 A$="DISK BASIC"
20 PRINT RIGHT$(A$, 5)
RUN
BASIC
Prints the rightmost five characters in the A$ string.

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/RIGHTS.html28/03/2004 21.29.34

You might also like