Packagevegas.util
Classpublic class NumberUtil

The NumberUtil utility class is an all-static class with methods for working with number.



Public Methods
 MethodDefined by
  
clone(n:Number):Number
[static] Returns a copy by reference of this Number.
NumberUtil
  
copy(n:Number):Number
[static] Returns a copy by value of this Number.
NumberUtil
  
equals(n1:Number, n2:Number):Boolean
[static] Compares if two Numbers are equal by value
NumberUtil
  
toBoolean(n:Number):Boolean
[static] Converts to an equivalent Boolean value.
NumberUtil
  
toHex(n:Number, prefix:String):String
[static] Returns the hexadecimal string representation of the specified number value.
NumberUtil
  
toSource(n:Number, ... rest):String
[static] Returns a string representation of the specified number.
NumberUtil
Method detail
clone()method
public static function clone(n:Number):Number

Returns a copy by reference of this Number.

Parameters
n:Number

Returns
Number — a copy by reference of this Number.
copy()method 
public static function copy(n:Number):Number

Returns a copy by value of this Number.

Parameters
n:Number

Returns
Number — a copy by value of this Number.
equals()method 
public static function equals(n1:Number, n2:Number):Boolean

Compares if two Numbers are equal by value

Parameters
n1:Number
 
n2:Number

Returns
Booleantrue if the two passed-in values are the sames.
toBoolean()method 
public static function toBoolean(n:Number):Boolean

Converts to an equivalent Boolean value.

Parameters
n:Number

Returns
Boolean
toHex()method 
public static function toHex(n:Number, prefix:String):String

Returns the hexadecimal string representation of the specified number value.

Parameters
n:Number — the number to format.
 
prefix:String — Optional string represention of the prefix of the return format string. If this argument is undefined the prefix is "0x".

Returns
String — the hexadecimal string representation of the specified number value.

Example
       import vegas.util.NumberUtil ;
            for (var i:uint =0 ; i<256 ; i++)
      {
          trace( NumberUtil.toHex( i ) ) ; // without optional prefix argument (default "0x")
      }
            trace("---") ; 
      
      for (var i:Number =0 ; i<256 ; i++)
       {
          trace( NumberUtil.toHex( i , "#" ) ) ; // with optional prefix argument
      }
       

toSource()method 
public static function toSource(n:Number, ... rest):String

Returns a string representation of the specified number.

Parameters
n:Number
 
... rest

Returns
String — a string representation of the specified number.