Jump to content

Recommended Posts

Posted
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.
Posted (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 by IamJon
Posted
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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...