Comparing String in Flash AS3
I’m making my first iOS and Android game. While coding this game, I wanted to compare two strings. I thought I could just use someString == stringXYZ. After some tests, I figured out my if statements where not being read. After some searching, I found out to test a string you need to use the Collator class. Once I coded the if statement using the Collator class, my if statement finally worked. Below is some notes on how to use the Collator class.
I want to give credit to the Adobe Flash platform documentation. This is where I found out about comparing strings.
var myMatcher:Collator = new Collator("fr-FR", CollatorMode.MATCHING);
if (matcher.equals(string1, string2))
trace("we have a match!");