Page 1 of 1

Comparing Strings

Posted: Tue May 24, 2011 6:44 pm
by cobra1
Hi, i have 2 strings that i would like to compare,

The first string called "in_string" is the data being received, in that string is 4 characters, e.g "STID"

The second string is called "STRING" and is in a string manipulation box, STRING = "STID"

OK, so i send my 4 characters STID and it stores them into the array,

After reading posts on the forum the only way i can find to compare them is to compare each character within the array using this.

(in_string[1] =STRING[1]) && (in_string[2] =STRING[2]) && (in_string[3] =STRING[3]) && (in_string[4] =STRING[4])

This works but seems a bit excessive, just dont want to do this if i needed say 10 characters,

So basically, is there a way to compare an entire string in a simpler way?

Re: Comparing Strings

Posted: Tue May 24, 2011 7:18 pm
by medelec35
Hi cobra1,
Yes there is a simpler way. You can use the compare() function which is found by clicking on functions of a string calculation box.
This function was discussed here:
http://www.matrixmultimedia.com/mmforum ... 586#p19818

Martin

Re: Comparing Strings

Posted: Tue May 24, 2011 7:44 pm
by cobra1
Hi Martin,

Thank you for the link, that works spot on for me now.