Two identical strings don't seem to match.

0 favourites
  • 4 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • I have two strings which appear identical. One is set up in a local string variable, as '442' and the other comes from an array and is also '442'.

    I've put them side by side on the screen and they both look exactly like that, but for some reason, a C3 match doesn't want to match them (i.e System String1 = String2 isn't triggering).

    I've tried trimming them both (e.g System trim(string1) = trim(string2)) but it's still not triggering.

    Am I missing something else that can make identical looking strings not match up?

  • I think this might actually be a bug in C3. I can run a check if anyone is interested, e.g Ashley?

    Basically, when I did the comparison between a string and the string in the array, it didn't match. But when I put the string in the array into another string and then compared the two strings, they matched. Not sure if I did something wrong somewhere but it does appear that a string in an array isn't the same as a string.... maybe that's as intended?

  • Maybe the string you are pulling from the array is treated like a number? "442" is not equal to 442

    Try adding str() to it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yep, you're spot on, that was the problem and adding str did fix it. Good to know for the future as I'll be using this string array quite a bit in my project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)