Hi Merlin,
I am using the function below for getting the leading text of a string, i.e. GetLeadingText("CH1") = "CH". This routine works fine when compiled normally. When I compile it with the Optimizer I get strange results like GetLeadingText("CH1") = "CCCC". I checked in the loop the value of lCnt and I get strange values like 88..?? Any Idea?
I send the ASM and DSM as PM.
Best regards, Michael
I am using the function below for getting the leading text of a string, i.e. GetLeadingText("CH1") = "CH". This routine works fine when compiled normally. When I compile it with the Optimizer I get strange results like GetLeadingText("CH1") = "CCCC". I checked in the loop the value of lCnt and I get strange values like 88..?? Any Idea?
Code
Function GetLeadingText1 (lStr : String[15]) : String[15]; // Returns the text 'CH' in a string like 'CH15' or 'YEAR' in 'YEAR2000'
Var
lTextStr : String[15];
lCnt : Byte;
Begin
lTextStr := '';
For lCnt := 1 To Length(lStr) Do
If lStr[lCnt] In ['0'..'9'] Then
Return (lTextStr);
Else
lTextStr := lTextStr + lStr[lCnt];
EndIf;
EndFor;
Return (lTextStr);
End;
Var
lTextStr : String[15];
lCnt : Byte;
Begin
lTextStr := '';
For lCnt := 1 To Length(lStr) Do
If lStr[lCnt] In ['0'..'9'] Then
Return (lTextStr);
Else
lTextStr := lTextStr + lStr[lCnt];
EndIf;
EndFor;
Return (lTextStr);
End;
I send the ASM and DSM as PM.
Best regards, Michael