final class Array.<T>
Array is a sequence of Nullable.<T> values. The size of an array is not fixed.
Unless otherwise noted, the defintions of the methods match those specified in ECMA-262, 3rd edition.
var length : number
A positive integer between 0 and a value less than 232 that specifies the number of elements in an array.
You can set the length property to truncate an array at any time. When you extend an array by changing its length property, the created elements are initialized to null.
new Array()
Constructs an empty array.
new Array(length : number)
Constructs an array of given length. The elements are initialized to null.
final override function toString()
: string
Returns a string representing the object.
final function toLocaleString()
: string
Returns a string representing the object.
final function concat(arrayN : ...Array.<T>)
: Array.<T>
Returns a new array comprised of this array joined with other array(s) and/or value(s).
arrayN |
Arrays to concatenate to the resulting array. |
final function join()
: string
Joins all elements of an array into a string, separating each element with a comma.
final function join(separator : string)
: string
Joins all elements of an array into a string.
separator |
Specifies a string to separate each element of the array. |
final function pop()
: Nullable.<T>
Removes the last element from an array and returns that element.
final function push(itemN : ...Nullable.<T>)
: int
Mutates an array by appending the given elements and returning the new length of the array.
itemN |
The elements to add to the end of the array. |
final function reverse()
: Array.<T>
Reverses an array in place. The first array element becomes the last and the last becomes the first.
final function shift()
: Nullable.<T>
Removes the first element from an array and returns that element. This method changes the length of the array.
final function slice(start : number)
: Array.<T>
Returns a one-level deep copy of a portion of an array.
start |
Zero-based index at which to begin extraction. |
final function slice(start : number, end : number)
: Array.<T>
Returns a one-level deep copy of a portion of an array.
start |
Zero-based index at which to begin extraction. |
end |
Zero-based index at which to end extraction. slice extracts up to but not including end. |
final function sort()
: Array.<T>
Sorts the elements of an array in place and returns the array. The sort is not necessarily stable. The array is sorted lexicographically (in dictionary order) according to the string conversion of each element.
final function sort(comparefn : function (:Nullable.<T>, :Nullable.<T>) : number)
: Array.<T>
Sorts the elements of an array in place and returns the array. The sort is not necessarily stable.
comparefn |
Specifies a function that defines the sort order. |
final function splice(start : number, deleteCount : number, itemN : ...T)
: Array.<T>
Changes the content of an array, adding new elements while removing old elements.
start |
Index at which to start changing the array. If negative, will begin that many elements from the end. |
deleteCount |
An integer indicating the number of old array elements to remove. |
itemN |
The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array. |
final function unshift(itemN : ...Nullable.<T>)
: int
Adds one or more elements to the beginning of an array and returns the new length of the array.
itemN |
The elements to add to the front of the array. |
final function indexOf(value : Nullable.<T>)
: number
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
final function indexOf(value : Nullable.<T>, fromIndex : number)
: number
final function lastIndexOf(value : Nullable.<T>)
: number
Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backward.
final function lastIndexOf(value : Nullable.<T>, fromIndex : number)
: number
final function every(callbackfn : function (:Nullable.<T>) : boolean)
: boolean
Tests whether all elements in the array pass the test implemented by the provided function.
final function every(callbackfn : function (:Nullable.<T>, :number) : boolean)
: boolean
final function every(callbackfn : function (:Nullable.<T>, :number, :Array.<T>) : boolean)
: boolean
final function some(callbackfn : function (:Nullable.<T>) : boolean)
: boolean
Tests whether some element in the array passes the test implemented by the provided function.
final function some(callbackfn : function (:Nullable.<T>, :number) : boolean)
: boolean
final function some(callbackfn : function (:Nullable.<T>, :number, :Array.<T>) : boolean)
: boolean
final inline function forEach(callbackfn : function (:Nullable.<T>) : void)
: void
Calls callbackfn once for each element in the array, in ascending order.
callbackfn |
A function to call for each element. |
final function forEach(callbackfn : function (:Nullable.<T>, :number) : void)
: void
final function forEach(callbackfn : function (:Nullable.<T>, :number, :Array.<T>) : void)
: void
final function map.<U>(callbackfn : function (:Nullable.<T>) : Nullable.<U>)
: Array.<U>
Creates a new array with the results of calling a provided function on every element in this array.
callbackfn |
A function that produces an element of the new Array.<U> from an element of the current one. |
final function map.<U>(callbackfn : function (:Nullable.<T>, :number) : Nullable.<U>)
: Array.<U>
final function map.<U>(callbackfn : function (:Nullable.<T>, :number, :Array.<T>) : Nullable.<U>)
: Array.<U>
final function filter(callbackfn : function (:Nullable.<T>) : boolean)
: Array.<T>
Creates a new array with all elements that pass the test implemented the provided function.
callbackfn |
A function to test each elements of the array. |
final function filter(callbackfn : function (:Nullable.<T>, :number) : boolean)
: Array.<T>
final function filter(callbackfn : function (:Nullable.<T>, :number, :Array.<T>) : boolean)
: Array.<T>
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>)
: Array.<T>
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. reduce
will throw TypeError
if the array contains no elements and no initialValue is suplied.
callbackfn |
A function to execute on each value in the element, taking four arguments: the previousValue (the value previously returned in the last invocation of the callback), the currentValue (the current element being processed in the array), the currentIndex and the array. |
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number) : Nullable.<T>)
: Array.<T>
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number, :Array.<T>) : Nullable.<T>)
: Array.<T>
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>, initialValue : T)
: Array.<T>
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number) : Nullable.<T>, initialValue : T)
: Array.<T>
final function reduce(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number, :Array.<T>) : Nullable.<T>, initialValue : T)
: Array.<T>
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>)
: Array.<T>
Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value.
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number) : Nullable.<T>)
: Array.<T>
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>, :number, :Array.<T>) : Nullable.<T>)
: Array.<T>
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>, initialValue : T)
: Array.<T>
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>, initialValue : T, currentIndex : number)
: Array.<T>
final function reduceRight(callbackfn : function (:Nullable.<T>, :Nullable.<T>) : Nullable.<T>, initialValue : T, currentIndex : number, array : Array.<T>)
: Array.<T>
final class String
A wrapper object for primitive string
s.
Unless otherwise noted, the defintions of the methods match those specified in ECMA-262, 3rd edition.
var length : int
The length of a string.
new String()
Constructs a String object containing an empty string.
new String(s : string)
Constructs a String object wrapping the given string.
new String(s : String)
Constructs a String object wrapping the value wrapped by the given object.
static final function fromCharCode(charN : ...number)
: string
Returns a string value containing as many characters as the number of arguments.
final override function toString()
: string
Returns this string value. (Note that, for a String object, the toString method happens to return the same thing as the valueOf method.)
final function valueOf()
: string
Returns this string value.
final function charAt(pos : number)
: string
Returns a string containing the character at position pos
in the string resulting from converting this object to a string. If there is no character at that position, the result is the empty string. The result is a string value, not a String object.
final function charCodeAt(pos : number)
: number
Returns a number (a nonnegative integer less than 216) representing the code point value of the character at position pos in the string resulting from converting this object to a string. If there is no character at that position, the result is NaN.
final function concat(stringN : ...string)
: string
When the concat
method is called with zero or more arguments string1
, string2
, etc., it returns a string consisting of the characters of this object followed by the characters of each of string1, string2, etc. The result is a string value, not a String object.
final function indexOf(searchString : string)
: int
If searchString appears as a substring of the result of converting this object to a string then the index of the smallest such position is returned; otherwise, -1 is returned.
final function indexOf(searchString : string, position : number)
: int
If searchString appears as a substring of the result of converting this object to a string, at one or more positions that are greater than or equal to position, then the index of the smallest such position is returned; otherwise, -1 is returned.
final function lastIndexOf(searchString : string)
: int
If searchString appears as a substring of the result of converting this object to a string then the index of the greatest such position is returned; otherwise, -1 is returned.
final function lastIndexOf(searchString : string, position : number)
: int
If searchString appears as a substring of the result of converting this object to a string at one or more positions that are smaller than or equal to position, then the index of the greatest such position is returned; otherwise, -1 is returned.
final function localeCompare(that : string)
: number
Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order. Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order. Returns a negative number if the string occurs earlier in a sort than compareString, returns a positive number if the string occurs afterwards in such a sort, and returns 0 if they occur at the same level.
that |
The string against which the referring string is comparing. |
final function match(regexp : RegExp)
: Array.<string>
Used to retrieve the matches when matching a string against a regular expression. If the regular expression does not include the g flag, returns the same result as regexp.exec(string). If the regular expression includes the g flag, the method returns an Array containing all matches. If there were no matches, the method returns null. The returned Array has an extra input property, which contains the regexp that generated it as a result. In addition, it has an index property, which represents the zero-based index of the match in the string.
regexp |
A regular expression object. |
final function replace(searchValue : string, replaceValue : string)
: string
Returns a new string with some or all matches of a pattern replaced by a replacement.
final function replace(searchValue : RegExp, replaceValue : string)
: string
Returns a new string with some or all matches of a pattern replaced by a replacement.
final function replace(searchValue : string, replaceValue : function (:string) : string)
: string
Returns a new string with some or all matches of a pattern replaced by a replacement.
final function replace(searchValue : RegExp, replaceValue : function (:string) : string)
: string
Returns a new string with some or all matches of a pattern replaced by a replacement.
final function search(searchValue : string)
: int
Executes the search for a match between a regular expression and this String
object.
final function search(searchValue : RegExp)
: int
Executes the search for a match between a regular expression and this String
object.
final function slice(start : number)
: string
Extracts a section of a string and returns a new string.
start |
The zero-based index at which to begin extraction. |
final function slice(start : number, end : number)
: string
Extracts a section of a string and returns a new string.
start |
The zero-based index at which to begin extraction. |
end |
The zero-based index at which to end extraction. |
final function split(separator : string)
: Array.<string>
Splits a String object into an array of strings by separating the string into substrings.
separator |
Specifies the character sequence to use for separating the string. |
final function split(separator : string, limit : number)
: Array.<string>
Splits a String object into an array of strings by separating the string into substrings.
separator |
Specifies the character sequence to use for separating the string. |
limit |
Integer specifying a limit on the number of splits to be found. The split method still splits on every match of separator , but it truncates the returned array to at most limit elements. |
final function split(separator : RegExp)
: Array.<string>
Splits a String object into an array of strings by separating the string into substrings.
separator |
Specifies an regular expression to use for separating the string. |
final function split(separator : RegExp, limit : number)
: Array.<string>
Splits a String object into an array of strings by separating the string into substrings.
separator |
Specifies an regular expression to use for separating the string. |
limit |
Integer specifying a limit on the number of splits to be found. The split method still splits on every match of separator , but it truncates the returned array to at most limit elements. |
final function substring(start : number)
: string
Returns a subset of a string
starting at the given offset.
start |
The zero-based index at which to begin extraction. |
final function substring(start : number, end : number)
: string
Returns a subset of a string
starting at the given offset.
start |
The zero-based index at which to begin extraction. |
end |
The zero-based index at which to end extraction. |
final function toLowerCase()
: string
Returns the calling string value converted to lowercase.
final function toLocaleLowerCase()
: string
Returns the calling string value converted to lowercase.
final function toUpperCase()
: string
Returns the calling string value converted to uppercase.
final function toLocaleUpperCase()
: string
Returns the calling string value converted to uppercase.
final function trim()
: string
Removes whitespace from both ends of the string.
static final function encodeURIComponent(str : string)
: string
Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
str |
A component of a URI. |
static final function decodeURIComponent(encodedURI : string)
: string
Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.
encodedURI |
An encoded component of a Uniform Resource Identifier. |
static final function encodeURI(str : string)
: string
Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
str |
A complete Uniform Resource Identifier. |
static final function decodeURI(encodedURI : string)
: string
Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine.
encodedURI |
A complete, encoded Uniform Resuorce Identifier. |
final class Math
Provides mathmetical constants and functions.
Unless otherwise noted, the defintions of the methods match those specified in ECMA-262, 3rd edition.
static const var E : number
Euler's constant and the base of natural logarithms, approximately 2.718.
static const var LN10 : number
Natural logarithm of 10, approximately 2.302.
static const var LN2 : number
Natural logarithm of 2, approximately 0.693.
static const var LOG2E : number
Base 2 logarithm of E, approximately 1.442.
static const var LOG10E : number
Base 10 logarithm of E, approximately 0.434.
static const var PI : number
Ratio of the circumference of a circle to its diameter, approximately 3.14159.
static const var SQRT1_2 : number
Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
static const var SQRT2 : number
Square root of 2, approximately 1.414.
static final function abs(x : number)
: number
Returns the absolute value of a number.
static final function acos(x : number)
: number
static final function asin(x : number)
: number
static final function atan(x : number)
: number
static final function atan2(y : number, x : number)
: number
static final function ceil(x : number)
: number
static final function cos(x : number)
: number
static final function exp(x : number)
: number
static final function floor(x : number)
: number
static final function log(x : number)
: number
static final function max(value1 : number, value2 : number, value3 : number, valueN : ...number)
: number
static final function max(value1 : number)
: number
static final function min(value1 : number, value2 : number, value3 : number, valueN : ...number)
: number
static final function min(value1 : number)
: number
static final function pow(x : number, y : number)
: number
static final function random()
: number
static final function round(x : number)
: number
static final function sin(x : number)
: number
static final function sqrt(x : number)
: number
static final function tan(x : number)
: number
static final function max(value1 : number, value2 : number)
: number
static final function min(value1 : number, value2 : number)
: number
final class Date
An object for working with dates and times.
Unless otherwise noted, the defintions of the methods match those specified in ECMA-262, 3rd edition.
new Date(year : number, month : number)
Creates a Date object.
new Date(year : number, month : number, date : number)
Creates a Date object.
new Date(year : number, month : number, date : number, hours : number)
Creates a Date object.
new Date(year : number, month : number, date : number, hours : number, minutes : number)
Creates a Date object.
new Date(year : number, month : number, date : number, hours : number, minutes : number, seconds : number)
Creates a Date object.
new Date(year : number, month : number, date : number, hours : number, minutes : number, seconds : number, ms : number)
Creates a Date object.
new Date(value : string)
Creates a Date object.
value |
String value representing a date. The string should be in a format recognized by the parse method (IETF-compliant RFC 2822 timestamps). |
new Date(value : number)
Creates a Date object.
value |
Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch). |
new Date(value : Date)
Clones the given object.
new Date()
Creates a Date object for today's date and time according to local time.
static final function parse(value : string)
: number
static final function UTC(year : number, month : number)
: number
static final function UTC(year : number, month : number, date : number)
: number
static final function UTC(year : number, month : number, date : number, hours : number)
: number
static final function UTC(year : number, month : number, date : number, hours : number, minutes : number)
: number
static final function UTC(year : number, month : number, date : number, hours : number, minutes : number, seconds : number)
: number
static final function UTC(year : number, month : number, date : number, hours : number, minutes : number, seconds : number, ms : number)
: number
static final function now()
: number
final override function toString()
: string
final function toDateString()
: string
final function toTimeString()
: string
final function toLocaleString()
: string
final function toLocaleDateString()
: string
final function toLocaleTimeString()
: string
final function valueOf()
: number
final function getTime()
: number
final function getFullYear()
: number
final function getUTCFullYear()
: number
final function getMonth()
: number
final function getUTCMonth()
: number
final function getDate()
: number
final function getUTCDate()
: number
final function getDay()
: number
final function getUTCDay()
: number
final function getHours()
: number
final function getUTCHours()
: number
final function getMinutes()
: number
final function getUTCMinutes()
: number
final function getSeconds()
: number
final function getUTCSeconds()
: number
final function getMilliseconds()
: number
final function getUTCMilliseconds()
: number
final function getTimezoneOffset()
: number
final function setTime(time : number)
: number
final function setMilliseconds(ms : number)
: number
final function setUTCMilliseconds(ms : number)
: number
final function setSeconds(sec : number)
: number
final function setUTCSeconds(sec : number)
: number
final function setMinutes(min : number)
: number
final function setUTCMinutes(min : number)
: number
final function setHours(hour : number)
: number
final function setUTCHours(hour : number)
: number
final function setDate(date : number)
: number
final function setUTCDate(date : number)
: number
final function setMonth(month : number)
: number
final function setUTCMonth(month : number)
: number
final function setFullYear(year : number)
: number
final function setUTCFullYear(year : number)
: number
final function toUTCString()
: string
final function toISOString()
: string
final function toJSON()
: string
final function toJSON(key : string)
: string