Clear Up
SharpKit Reference

Number Class

A collection of useful static methods to deal with numbers

Namespace: Ext

Base Types

System.Object

Constructors

Methods

Name Description
constrain(JsNumber, JsNumber, JsNumber) Checks whether or not the passed number is within a desired range. If the number is already within the range it is returned, otherwise the min or max value is returned depending on which side of the range is exceeded. Note that this method returns the constrained value but does not change the current number.
from(object, JsNumber) Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if it is not.
  Ext.Number.from('1.23', 1); // returns 1.23
            Ext.Number.from('abc', 1); // returns 1
            
randomInt(JsNumber, JsNumber) Returns a random integer between the specified range (inclusive)
snap(JsNumber, JsNumber, JsNumber, JsNumber) Snaps the passed number between stopping points based upon a passed increment value. The difference between this and snapInRange is that snapInRange uses the minValue when calculating snap points:
r = Ext.Number.snap(56, 2, 55, 65);        // Returns 56 - snap points are zero based
            r = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue
            
snapInRange(JsNumber, JsNumber, object, object) Snaps the passed number between stopping points based upon a passed increment value. The difference between this and snap is that snap does not use the minValue when calculating snap points:
r = Ext.Number.snap(56, 2, 55, 65);        // Returns 56 - snap points are zero based
            r = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue
            
toFixed(JsNumber, JsNumber) Formats a number using fixed-point notation
© Copyright 2005-2011 SharpKit. All rights reserved.