17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

MID$ Function<br />

Purpose:<br />

To return a string of m characters from x$ beginning with the nth character.<br />

Syntax:<br />

MID$(x$,n[,m])<br />

Comments:<br />

n must be within the range of 1 to 255.<br />

m must be within the range of 0 to 255.<br />

If m is omitted, or if there are fewer than m characters to the right of n, all rightmost characters<br />

beginning with n are returned.<br />

If n > LEN(x$), MID$ function returns a null string.<br />

If m equals 0, the MID$ function returns a null string.<br />

If either n or m is out of range, an "Illegal function call error" is returned.<br />

For more information and examples, see the LEFT$ and RIGHT$ functions.<br />

Examples:<br />

10 A$="GOOD"<br />

20 B$="MORNING EVENING AFTERNOON"<br />

30 PRINT A$; MID$(B$, 8, 8)<br />

RUN<br />

GOOD EVENING<br />

Line 30 concatenates (joins) the A$ string to another string with a length of eight characters,<br />

beginning at position 8 within the B$ string.<br />

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!