Comparing Strings

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Comparing Strings

Post 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?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Comparing Strings

Post 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
Martin

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: Comparing Strings

Post by cobra1 »

Hi Martin,

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

Post Reply