EasyManua.ls Logo

Crestron SIMPL+ - Mid Function

Crestron SIMPL+
374 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G SIMPL+
®
z 227
Mid
Name:
Mid
Syntax:
STRING Mid(STRING SOURCE, INTEGER START, INTEGER NUM);
Description:
Returns a string NUM characters long from SOURCE, starting at position START.
Parameters:
SOURCE is a STRING containing the input string.
START is an INTEGER telling MID at which character position in SOURCE to start.
The first character of SOURCE is considered 1.
NUM is an INTEGER telling MID how many characters to use from SOURCE.
Return Value:
A string NUM characters long starting at START.
If START is greater than the length of SOURCE, an empty STRING is returned.
If NUM is greater than the total number of characters that can be retrieved starting
from START, only the remaining characters in SOURCE will be pulled. For
example, MID(“ABCD”, 2, 10) would return a STRING containing BCD.
Example:
STRING_INPUT Var$[100];
STRING Temp$[100];
CHANGE Var$
{
Temp$ = MID(Var$, 2, 5);
PRINT(“String starting at position 2 for 5 characters is
%s\n”,Temp$);
}
In this example, if Var$ contains “abcdefghijklmnop”, then Temp$ will contain
“bcdef”.
Version:
SIMPL+ Version 1.00

Table of Contents