Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I am having trouble making the Function "STRING_COMAPRE" from the Standard library work. Gut-Feeling says its simple but be darned if I can see what I am doing incorrectly. Looks like this:
VAR
T_Input_Word:STRING(5):='10123';
T_Req_Word:STRING(5):='10122';
STRING_COMPARE1:BOOL;
END_VAR
Code is 16bit, but is presently running under simulation only. I tried the string function "LEN" under simulation and it works fine returning the lengths of both strings when programmed.
Anybody see what I am doing incorrectly?
Thanks,
Wally
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i can not find a string_compare in standard,
in :
The Library SysLibStr.lib
Please regard: It depends on the target system, which system libraries can be used in the application program. Please see the document SysLibs_Overview.pdf.
This library provides functions for string operations. If the target system is supporting the functionality, the following functions can be used to compare or copy strings or to retrieve the length of a string. The execution is synchronous.
SysStrCmp
SysStrCmpI
SysStrCmpN
SysStrCmpNI
SysStrCpy
SysStrLen
So you can do it with this library
or you can also use oscat.lib it has loads of functions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Originally created by: xj750rj
Hello Everyone,
I am having trouble making the Function "STRING_COMAPRE" from the Standard library work. Gut-Feeling says its simple but be darned if I can see what I am doing incorrectly. Looks like this:
VAR
T_Input_Word:STRING(5):='10123';
T_Req_Word:STRING(5):='10122';
STRING_COMPARE1:BOOL;
END_VAR
Code:
STRING_COMPARE1:=STRING_COMPARE (T_Input_Word, T_Req_Word) ;
Code is 16bit, but is presently running under simulation only. I tried the string function "LEN" under simulation and it works fine returning the lengths of both strings when programmed.
Anybody see what I am doing incorrectly?
Thanks,
Wally
i can not find a string_compare in standard,
in :
The Library SysLibStr.lib
Please regard: It depends on the target system, which system libraries can be used in the application program. Please see the document SysLibs_Overview.pdf.
This library provides functions for string operations. If the target system is supporting the functionality, the following functions can be used to compare or copy strings or to retrieve the length of a string. The execution is synchronous.
SysStrCmp
SysStrCmpI
SysStrCmpN
SysStrCmpNI
SysStrCpy
SysStrLen
So you can do it with this library
or you can also use oscat.lib it has loads of functions.