Chapter 12 Example 11

by actionscriptbible
♥0 | Line 12 | Modified 2009-07-23 07:15:29 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/wnRp
 */

package {
  import com.actionscriptbible.Example;
  public class ch12ex11 extends Example {
    public function ch12ex11() {
      trace(removeLetters("catch", "cathy catnaps in cathay")); //y nps in y
      trace(removeLetters("bol", "Bob Loblaw Law Blog")); // aw aw g
    }
    public function removeLetters(inWord:String, fromWord:String):String {
      return fromWord.replace(new RegExp("[" + inWord + "]", "gi"), "");
    }
  }
}