Industrielle styresystemer - Wiki
Code Block | ||||
---|---|---|---|---|
| ||||
FUNCTION FSplitString : ARRAY[0..200] OF STRING(255)
VAR_INPUT
sInput : STRING(255);
sSplitChar : STRING(1);
numbObject : INT;
END_VAR
VAR
sInputCopy : STRING(255);
sSplitValue : STRING(255);
iSplitLength : INT := 0;
i : INT;
END_VAR |
Code Block | ||||
---|---|---|---|---|
| ||||
sInputCopy := sInput;
FOR i := 0 TO (numbObject * 2) DO
IF FIND(sInputCopy, sSplitChar) > 0 THEN
sSplitValue := LEFT(sInputCopy, FIND(sInputCopy, sSplitChar) - 1);
iSplitLength := LEN(sSplitValue) + 1;
ELSE
sSplitValue := sInputCopy;
iSplitLength := LEN(sSplitValue);
END_IF
sInputCopy := DELETE(sInputCopy, iSplitLength, 1);
FSplitString[i] := sSplitValue;
IF LEN(sInputCopy) = 0 THEN
EXIT;
END_IF
END_FOR |