Deadboyiv Posted September 27, 2012 Report Posted September 27, 2012 Ok does anyone out there know how to compare strings in an S7300 PLC? I can find all kinds of other compare functions but nothing for strings. Can this be done or do I need to break it down into individual characters or word values or something and do multiple compares that way? Any help is appreciated. Quote
IamJon Posted October 2, 2012 Report Posted October 2, 2012 (edited) From Siemen's help file: Element Type Data Type Y BYTE W WORD X DWORD I Integer D Integer B BOOL C CHAR R REAL You will need to break it down to fit one of these. STL is a lot more lenient - it doesn't do type checking. So it won't matter what data type it is, as long as the bit length is the same as what it's looking for. Apparently, you can also turn type checking off in Ladder, but I haven't done that. The other option would be to create an FB that does a string compare, with IN and OUT parameters. Then all you have to do is call this FB and pass parameters to it instead of retyping the same code over again. Edited October 2, 2012 by IamJon Quote
Rastinjus Posted October 16, 2012 Report Posted October 16, 2012 The Methods for Comparing Strings; Method Description, the boolean endsWith(String suffix) boolean startsWith(String prefix) Returns true if this string ends with or begins with the better program . Boarding Ladders Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.