Helpful stuff on Flash, ActionScript, After Effects etc

cases, code, tips and guidance

ActionScript 3.0: using the search method of the String class, part 1

without comments

if using the search method of the String class, this would trace; do stuff to you:

var teststr:String = "blablabla";
if(teststr.search(/bl/i) > -1) {
          trace("do stuff");
}

and this wouldn’t:

var teststr:String = "blablabla";
if(teststr.search(/br/i) > -1) {
          trace("do stuff");
}

doing the same kind of search in a String with HTML-text, this would trace out; do stuff to you:

var teststr:String = "blab<br>labla";
if(teststr.search(/\<br\>/i) > -1) {
          trace("do stuff");
}

and this wouldn’t:

var teststr:String = "blablabla";
if(teststr.search(/\<br\>/i) > -1) {
          trace("do stuff");
}
Bookmark and Share

Written by admin

februar 5th, 2010 at 12:29 pm

Posted in ActionScript, Flash

Tagged with ,

Leave a Reply