Actionscript 3: Checking Whether a String Contains Another String
I just ran across some great ActionScript string examples at Foundation Flash. I highly recommend reading the entire entry. I’m pasting a portion of it here so I can find it easily again:
var masterString:String = "Foundation Flash is great, all others are rubbish";
trace(String(masterString.indexOf("bad")));
//traces "-1" i.e. not found
trace(String(masterString.indexOf("great")));
//traces "20" i.e. found
trace(String(masterString.indexOf("great",26)));
//traces "-1" i.e. not found (after the 26th character (','))
trace(String(masterString.indexOf("Foundation")));
// traces "0"
trace(String(masterString.indexOf("flash")));
//traces "-1" i.e. not found
trace(String(masterString.toLowerCase().indexOf("flash")));
//traces "11" i.e. found
2 Comments:
Easily I agree but I contemplate the list inform should secure more info then it has.
Good brief and this post helped me alot in my college assignement. Thanks you as your information.
Posta un commento
<< Home