The
NumberUtil utility class is an all-static class with methods for working with number.
public static function clone(n:Number):Number
Returns a copy by reference of this Number.
Parameters
Returns
| Number — a copy by reference of this Number.
|
public static function copy(n:Number):Number
Returns a copy by value of this Number.
Parameters
Returns
| Number — a copy by value of this Number.
|
public static function equals(n1:Number, n2:Number):Boolean
Compares if two Numbers are equal by value
Parameters
Returns
| Boolean — true if the two passed-in values are the sames.
|
public static function toBoolean(n:Number):Boolean
Converts to an equivalent Boolean value.
Parameters
Returns
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
}
public static function toSource(n:Number, ... rest):String
Returns a string representation of the specified number.
Parameters
Returns
| String — a string representation of the specified number.
|