Supported: Internet Explorer 6+ Supported: Mozilla Firefox 2+ Supported: Apple Safari 3+ Supported: Google Chrome Supported: Opera 9+ Supported: Konqueror

Built-in Objects Extentions

String Methods

has( String pattern)

Returns true if string contains given pattern, false otherwise.

trim()

Returns string with whitespaces stripped from the begining and the end of current string.

toArray()

Returns string characters split into array.

isJson()

Returns true if current string has a valid JSON format, false otherwise.

toJson()

Returns self packed to JSON format.

evalJson()

Eveluates JSON string and returns obtained JSON object.

qsHash()

Split string having format similar to QUERY_STRING (param=value&param2=value2&…) into JavaScript Object having pairs param/value, like: { param : value, param2 : value2, … }

strip()

Returns current string with stripped any HTML tags.

qw()

Splits given string into chunks treating all spaces. This could be useful when you need to represent an array as string.
Example:

alert( $w( 'foo bar'));


Array Methods

inArray( Mixed item)

Returns true if passed as argument item is found in current array, otherwise returns false.

toJson()

Returns self packed to JSON format string.

uniq()

Returns an array consists only of unique elements, obtained from current array.

revoke( Mixed value)

Returns an array built from current but without an item having passed as argument value.

first()

Returns first element of an array.

last()

Returns last element of an array.

clear()

Empty current array and make the length of its elements equal 0.


RegExp Methods

match( String str)

It’s an alias to RegExp test() function. This method is used to search for a match of a regular expression in a string. Returns true if a match is found, and false if not.

escape( String str)

Escapes passed string special RegExp characters with backslash for future using the string in a regular expressions. Returns escaped string.


Function Methods

blank()

Just an empty function that actualy does nothing. Maybe useful some time to assign a reference to it with some events. For example:

...
// someElement is defined somwhere above
someElement.onclick = Function.blank;

bind( obj [, arguments...])

Creates and returns wrapper function in replacement of a current by passing to it all required arguments has been passed here during a call. For example:

// imagine thet obj1 &obj2 some elements defined above:
obj1.onload = obj2.onload.bind( obj1, arg1, arg2, arg3);