Select Page

Leading Zero Static function for digital clock

If you’ve ever created a digital timer or clock then you probably used something like this function. It adds a leading zero if the number is only one digit long. This means that if the minute value is ‘6’ then it will return ’06’. eg. 12:06:43

class com.sitedaniel.utils.StringUtil
	public function StringUtil(){}
	 * leadingZero
	 * Adds a zero if the length is less than 2
	 * @param	s
	 * @return  String with length of 2
	input '0'  return '00'
	input '5'  return '05'
	input '24' return '24'
	public static function leadingZero(s:String):String {
		switch (s.length){
			case 1 :
				return "0" + s;
			case 2 :
				return s;
			default :
				return s;

Dead Set launch

The E4 Dead Set site went live on Friday.
The build was enjoyable as there are many interesting video and sound effects.
It is XML driven and uses the BrightCove FLV player and Omniture Tracking.