MID$()

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
MID$( str$, start [, num]) = str2$ 
str2$ = MID$( string$, start [, nbr] )

Description:

str2$ = MID$( string$, start [, nbr] )
Returns a substring of ‘string$’ beginning at ‘start’ and continuing for ‘nbr’ characters. 
The first character in the string is number 1. 
If ‘nbr’ is omitted the returned string will extend to the end of ‘string$’

PRINT MID$("He was wearing a black shirt",18,5)

Output:
black


MID$( str$, start [, num]) = str2$  (CMM2 and ArmiteF4 only)
The characters in 'str$', beginning at position 'start', are replaced by the characters in 'str2$'. 
The optional 'num' refers to the number of characters from 'str2' that are used in the replacement. 
If 'num' is omitted, all of 'str2' is used. 
Whether 'num' is omitted or included, the replacement of characters never goes beyond the original length of 'str$'.

s$ = "He was wearing a black shirt"
mid$(s$,18,5) = "white"

print s$

Output:

He was wearing a white shirt

 

Last edited: 25 February, 2021