
|
<<
Index
>>
|
FutureBasic 5
|
mid$ and mid$$
|
|
function
|
|
Syntax:
subPascalString = mid$(PascalString,startPos [,numChars])
subContainer$$ = mid$$(container$$,startPos [,numChars])
Description:
This function returns a substring or subcontainer of PascalString
or container$$
, consisting of characters which begin at position startPos
within PascalString
or container$$
. If you specify numChars
, then a maximum of numChars
characters are returned; otherwise, all the characters from startPos
to the end of PascalString
or container$$
are returned. If startPos
is less than 1, then it's treated as 1. If startPos
is greater than the length of PascalString
or container$$
, then a null (zero-length) string is returned.
Note:
You may not use complex expressions that include containers on the right side of the equal sign. Instead of using:
c$$ = c$$ + mid$$(a$$,10)
Use:
c$$ += mid$$(a$$,10)
Example:
print mid$("Rick Brown", 2, 3)
myContainer$$ = "Rick Brown"
print mid$(myContainer$$, 2, 3)
print mid$("Rick Brown", 6)
program output:
ick
ick
Brown
See Also:
mid$ statement; left$; right$; instr