Sign in to follow this  
Followers 0
Deadboyiv

Comparing Strings?

3 posts in this topic

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0