I have a string like this:
var tempSting:String = "abc@abc.com;xyz@xyz.com"
I want to add this String into the ArrayCollection. And the above String should be divided by mail id and remove the ; symbol and need to add asArrayCollection
tempAc:Arraycollection = new ArrayCollection{abc@abc.com, xyz@xyz.com}
Please help me to add the split String into the ArrayCollection.
EDIT Now that I see Shane’s answer I must add the following:
This code will append the array to the arraycollection. If you just want to create a new arraycollection, all you need to do is:
or in 1 line,
UPDATE – to answer questions in the comments:
tempAc.getItemAt(i)will give you the email id at the i th positiontempAc.getItemIndex("someone@email.com")will give you the index at whichsomeone@email.comexists in the arraycollection (or -1 if not contained)tempAc.contains("someone@email.com")will returntrueorfalsedepending on if the string is contained or not in the arraycollectionSo, to check for duplicate ids, all you got to do is: