Static Methods : static « Class « Flash / Flex / ActionScript






Static Methods

 
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        StringUtils.contains("me@moock.org", "@");
    }
  }
}

internal class StringUtils {
  public static function contains (string, character) {
    for (var i:int = 0; i <= string.length; i++) {
      if (string.charAt(i) == character) {
        return true;
      }
    }
    return false;
  }
}

        








Related examples in the same category

1.Static Variables
2.Using Static Methods and Properties
3.Static Variables: define methods and properties that belong to the class itself, rather than their instances.
4.Reference static variable
5.Static Constants