[r5]: / trunk / json / json-pac / Functions / SPLIT_VARNAME / svnobj  Maximize  Restore  History

Download this file

5 lines (5 with data), 7.3 kB

Gx_li!0…jüo0F‚A°System.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagTextÒ(*=======================================================================================================SPLIT_VARNAME()VAuthor: Tim Van Meppelen, Pro Electric Inc.(timv@proelectric.com&Date: June 26, 2018bsplit a string into an array at the '.' characterTO DO:h'a.b.c.d' becomes an array[1]=d, [2]=c, [3]=b, [4]=axmodified from https://forum.codesys.com/viewtopic.php?t=9889Ô========================================================================================================*)ž//Loop through string until there is no string left or array has hit its limits^WHILE (StrLenA(pstData:= ADR(StringIn)) > 0) DOJ	//Find location of first break pointÂ	iSplitLocation := StrFindA(pst1:= ADR(StringIn), pst2:= ADR(SPLIT_CHAR), uiSearchStart:= 1) - 1;	 Ž	//If there is no break point found then set location to size of string!<	IF (iSplitLocation = -1) THEN"„		iSplitLocation := DINT_TO_INT(StrLenA(pstData:= ADR(StringIn)));#	END_IF$  %€	//Copy the part of the string that is needed for the parameter.&	StrMidA('0			pst:= ADR(StringIn), (R			uiInputBufferSize:= SIZEOF(StringIn), ):			iLength:= iSplitLocation, *$			iPosition:= 1, +D			pstResult:= ADR(sShortString), ,\			uiResultBufferSize:= SIZEOF(sShortString));-~	//Make sure string is not empty before using up an array spot..f	IF (StrLenA(pstData:= ADR(sShortString)) > 0) THEN/N		TempArray[ArraySize] := sShortString;0:		ArraySize := ArraySize + 1;1X	//Remove copied components from long string2¼	StrDeleteA(pby:= ADR(StringIn), iLength:= (iSplitLocation + LEN(SPLIT_CHAR)), iPosition:= 1);3Š	//Check to see if more parameters can fit in array. If not exit loop4T	IF (ArraySize > GPL_JSON.MAX_LEVELS) THEN5		EXIT;6	END_IF 7END_WHILE84ArraySize:= ArraySize - 1;92FOR i:= 0 TO ArraySize DO:@//reverse the order of the array;d	VarNameArray[i+1].Name:= TempArray[ArraySize-i];	<END_FOR=4SPLIT_VARNAME:= ArraySize;>Interface?L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}@<FUNCTION SPLIT_VARNAME : UINT;AVAR_INPUTB’	VarNameArray:	REFERENCE TO ARRAY[1..GPL_JSON.MAX_LEVELS] OF JSONVARNAME;Ct	StringIn: 		STRING(GPL_JSON.MAX_VAR_NAME);	//input stringDEND_VAREVAR CONSTANTF@	SPLIT_CHAR : 	STRING(1):= '.';	GVARH.	ArraySize:			UINT:= 1;I8    sShortString : 		STRING;J4    iSplitLocation : 	INT;K	i:					UINT;Ll	TempArray:			ARRAY[1..GPL_JSON.MAX_LEVELS] OF STRING;M"UniqueIdGeneratorN94OPOULevelPL{8e575c5b-1d37-49c6-941b-5c0ec7874787}QStandardR ChildObjectGuidsS8System.Collections.ArrayListT,AddAttributeSubsequentUboolÐÐ-ÐÐ	E
7ÐÐ
­ÚÐ-ÐÐ
­	ÚÐ-ÐÐ
­
ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­
ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ ÚÐ-ÐÐ
­!ÚÐ-ÐÐ
­"ÚÐ-ÐÐ
­#ÚÐ- ÐÐ
­$ÚÐ-!ÐÐ
­%ÚÐ-"ÐÐ
­&ÚÐ-#ÐÐ
­'ÚÐ-$ÐÐ
­(ÚÐ-%ÐÐ
­)ÚÐ-&ÐÐ
­*ÚÐ-'ÐÐ
­+ÚÐ-(ÐÐ
­,ÚÐ-)ÐÐ
­-ÚÐ-*ÐÐ
­.ÚÐ-+ÐÐ
­/ÚÐ-,ÐÐ
­0ÚÐ-ÐÐ
­1ÚÐ--ÐÐ
­2ÚÐ-.ÐÐ
­3ÚÐ-/ÐÐ
­4ÚÐ-0ÐÐ
­5ÚÐ-#ÐÐ
­6ÚÐ-ÐÐ
­7ÚÐ-1ÐÐ
­8ÚÐ-2ÐÐ
­9ÚÐ-ÐÐ
­:ÚÐ-3ÐÐ
­;ÚÐ-4ÐÐ
­=ÚÐ-5ÐÐ
­>ÚÐ-6ÐÐ
­GÚÐ-7ÐÐ
­RÚÐ-ÐÐ
­SÚÐ-8ÐÐ
­HÚÐ-ÐÐ
­IÚÐ-9ÐÐ
­JÚÐ-:ÐÐ
­KÚÐ-;ÐÐ
­^ÚÐ-<ÐÐ
­\ÚÐ-ÐÐ
­]ÚÐ-=ÐÐ
­ÚÐ-Ð>?Ð	E
ÐÐ
­?ÚÐ-@ÐÐ
­YÚÐ-AÐÐ
­DÚÐ-BÐÐ
­BÚÐ-CÐÐ
­@ÚÐ-DÐÐ
­[ÚÐ-ÐÐ
­WÚÐ-EÐÐ
­XÚÐ-FÐÐ
­UÚÐ-DÐÐ
­ÚÐ-ÐÐ
­ZÚÐ-GÐÐ
­ÚÐ-HÐÐ
­ÚÐ-IÐÐ
­ÚÐ-JÐÐ
­QÚÐ-KÐÐ
­ÚÐ-LÐÐ
­ÚÐ-DÐÐ
­ÚÐ-ÐM-NÐOP-QRSÐTU­