Microsoft ASP. NET Ajax framework entry (5) object type, string type, array type

Source: Internet
Author: User
Vs2008

This document describes the object type, string type, and array type.

Object Type
(1) GetType Method
Obtains the type of an object instance.
(2) gettypename Method
Obtains the type name of an object instance. Userlogic = Function () {
This. _ Username= "Guo";
}
Userlogic. Prototype =   {
Get_username: function () {
Return This. _ Username;
}
} ;
Userlogic. registerclass ( " Userlogic " );

VaR u =   New Userlogic ();

Alert (object. gettypename (U );
Alert (object. GetType (u ));

String type
(1) startswith Method
Determines whether the string starts...
(2) endswith Method
Judge whether the string ends...
(3) trim method
Removes spaces on both sides of the string.
(4) trimstart Method
Remove the space on the left of the string.
(5) trimend Method
Remove spaces on the right of the string
(6) format Method
Format a string
(7) localeformat Method
Format the string. The format of the date and number objects is based on the current cultrue VaR s =   " Today is {0} " ;
Alert (string. Format (S, New Date ()));
Alert (string. localeformat (S, New Date ()));

Array type
Add Method
Add an item
Addrange Method
Add an array to the end
Clear Method
Remove all elements
Clone Method
Clone an array
Contains Method
Whether the specified item is included
Dequeue Method
Remove the first item from the beginning
Enqueue Method
Same as the Add Method
Foreach Method
Traverse the array and subscribe to an Array Processing Function
Indexof Method
Locate the element that matches the given item and return its index value
Insert Method
Insert an item in the array
Parse Method
Converts a string to an array. The string format must be: "['Item1', 'item2', 'item3']"
Remove Method
Removes the first element that matches the given item.
Removeat Method
Removes the element at the given index location.

Examples: VaR arr = [ " Gzj " , " Jww " ];
Array. Add (ARR, " Wen " );
Alert (ARR. Join ( " , " ));

Array. addrange (ARR ,[ " CC " , " Dd " , " CC " ]);
Alert (ARR. Join ( " , " ));

Array. Remove (ARR, " CC " );
Alert (ARR. Join ( " , " ));

Usage of the foreach method:VaR arr = [ " Gzj " , " Jww " ];

This . Prefix =   " $ " ;
Array. foreach (ARR, addprefix, This );

Function addprefix (element, index, array) {< br> alert (element);
alert (INDEX );
alert (array. tostring ();
alert ( This . prefix);
}

VaR s= "['Item1', 'item2', 'item3']";
VaR arr=Array. parse (s );
Alert (ARR. Join ("|"));

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.