EMMA 02

BASIC

  • Home
  • Download
  • Change Log
  • Help
  • Compilation
    • Windows
    • OS X
    • Ubuntu
    • Fedora
    • openSUSE
  • Forums
  • Tape Conversion
  • Machine Code
    • SYSTEM00
    • CDP1801
    • CDP1802
    • CDP1804
    • CDP1805
    • Differences
  • Pseudo Code
    • AMVBAS
    • AM4KBAS
    • CARDTRAN
    • Chip-8, 8X, ETI-660 & Elf
    • FEL-1
    • FPA-1
    • FPL-2
    • FPL-4
    • GPL-2
    • GPL-3
    • GPL-4
    • GPL-A (2K RAM)
    • GPL-A (2K ROM)
    • ST2
    • ST4
    • STK
    • Test-Word
    • Super-chip
  • XML Code
    • Main Elements
    • I/O
    • System
    • A/D Convertor
    • BASIC
    • Batch wav
    • Bootstrap
    • Cassette
    • CD4536B
    • CDP1851
    • CDP1852
    • CDP1854
    • CDP1855
    • CDP1877
    • CDP1878
    • CDP1879
    • Debugger
    • COMX Diagnostic
    • Dip switch
    • Disk
    • EF Buttons
    • Flip Flop
    • Front Panel
    • GUI
    • HEX Modem
    • I/O Group
    • Keyboard
    • Keyfile
    • Locations
    • Memory
    • MM57109
    • Printer
    • RTC
    • Sound
    • Splash
    • USB
    • Video
    • Videodump
    • vt
    • X Modem
  • BASIC
    • General Information
    • COMX BASIC V1.00
    • Floating Point BASIC 2.2
    • Pecom 32 BASIC
    • Pecom 64 BASIC 1.0 & 4.0
    • Quest Super BASIC 1.4
    • Quest Super BASIC 3.0
    • Quest Super BASIC 5.0
    • Quest Super BASIC 6.0
    • RCA BASIC3 V1.1
    • Telmac SBASIC v24.3
    • Error Messages
  • Computer List

 

 

 

 

 

 

 

 

 

 

 

 

MID$

Format:
sting var = MID$ (string expr, expr1)
sting var = MID$ (string expr, expr1, expr2)

Supported by: COMX BASIC V1.00, Floating Point BASIC 2.2, Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0, Quest Super BASIC 1.4, 3.0, 5.0 and 6.0, RCA BASIC3 V1.1, Telmac SBASIC v 24.3

Similar commands: -

This function is a string function which, when executed, extracts a portion of the specified string. The first term, expr1, defines which character from the left is to start the substring. Expr2 defines the number of characters to be used in the substring. If expr2 is not used, all of the remaining characters are used.

The following is an example.

A$="YES"
B$=MID$ (A$, 2, 1)

B$ would then contain the letter "E".

A$(10)="EXPERIMENT"
PR MID$ (A$(10), 7, 3)

would result in

MEN

being printed.

10 INPUT A$ (1)
20 IF MID$(A$(1), 1, 1)="Y" GOTO 100
30 GOTO 10
100 END

The last example would wait until some word beginning with the letter "Y" was input at which time the program would branch to line #100.

Common functions like LEFT$ and RIGHTS of other BASICs can be implemented with the MID$ function in the following way

MID$ (A$, 1, N)

is the same as

LEFT$(A$, N)

And

MID$(A$, (LEN(A$)-N+1), LEN(A$))

is the same as

RIGHT$(A$,N)