Packageorg.as3utils
Classpublic final class NumberUtil
InheritanceNumberUtil Inheritance Object

A utility class to work with Number objects.



Public Methods
 MethodDefined By
  
NumberUtil is a static class and shouldn't be instantiated.
NumberUtil
  
isEven(value:Number):Boolean
[static]
NumberUtil
  
isNotNumber(num:Number):Boolean
[static] Checks if the value of the Number object is NaN(not a number).
NumberUtil
  
isNumber(num:Number):Boolean
[static] Checks if the value of the Number object is a number.
NumberUtil
  
isOdd(value:Number):Boolean
[static]
NumberUtil
  
round(num:Number, rounding:NumericRounding):Number
[static]
NumberUtil
  
zeroPrecedent(num:Number, lessThan:Number = 10):String
[static]
NumberUtil
Constructor Detail
NumberUtil()Constructor
public function NumberUtil()

NumberUtil is a static class and shouldn't be instantiated.


Throws
IllegalOperationError — NumberUtil is a static class and shouldn't be instantiated.
Method Detail
isEven()method
public static function isEven(value:Number):Boolean

Parameters

value:Number

Returns
Boolean
isNotNumber()method 
public static function isNotNumber(num:Number):Boolean

Checks if the value of the Number object is NaN(not a number).

This method uses the native AS3 isNaN() global function

Parameters

num:Number — a Number object to evaluate.

Returns
Booleantrue if the value is NaN (not a number) and false otherwise.

Example
         import org.as3coreaddendum.utils.NumberUtil;
         
         var num:Number;
         
         trace("num: " + num)            // NaN
         
         NumberUtil.isNotNumber(null)    // false
         NumberUtil.isNotNumber(num)     // true
         NumberUtil.isNotNumber(1)       // false
         NumberUtil.isNotNumber(-1)      // false
         NumberUtil.isNotNumber(NaN)     // true
         
isNumber()method 
public static function isNumber(num:Number):Boolean

Checks if the value of the Number object is a number.

This method uses the native AS3 isNaN() global function

Parameters

num:Number — a Number object to evaluate.

Returns
Booleantrue if the value is a number and false if it is NaN (not a number).

Example
         import org.as3coreaddendum.utils.NumberUtil;
         
         var num:Number;
         
         trace("num: " + num)         // NaN
         
         NumberUtil.isNumber(null)    // true
         NumberUtil.isNumber(num)     // false
         NumberUtil.isNumber(1)       // true
         NumberUtil.isNumber(-1)      // true
         NumberUtil.isNumber(NaN)     // false
         
isOdd()method 
public static function isOdd(value:Number):Boolean

Parameters

value:Number

Returns
Boolean
round()method 
public static function round(num:Number, rounding:NumericRounding):Number

Parameters

num:Number
 
rounding:NumericRounding

Returns
Number
zeroPrecedent()method 
public static function zeroPrecedent(num:Number, lessThan:Number = 10):String

Parameters

num:Number
 
lessThan:Number (default = 10)

Returns
String