JavaScript---string and arry

Source: Internet
Author: User

1 varstr = "Liuzhanqi";2document.write (str["Length"]);//equivalent STR.L ength3 4 varstr = String.fromCharCode (72, 101, 108, 108, 111, 33);5document.write (str);//Each integer is encoded as Unicode and concatenated into a string. 6 7 varstr1 = "Liu". Localecompare ("Zhan");//Compare the current string with the parameter string by default comparison rules provided by the system8document.write (STR1);//9 Ten varstr2 = "Liu". Slice (1);//extracts a substring in the current string One Document.writeln (str2); A  -Document.writeln ("se nki". Split ("));//splits a string with a delimiter, returning an array.  -document.write (' Liu ' fontcolor (' red '))); thedocument.write (' Liu '. fixed ());//make a string appear as a equal width word -document.write (' Liu '. strike ());//add strikethrough on a string -document.write ("Senki". Sub ());//Display as subscript -document.write ("Senki". sup ());//Display as superscript
View Code

charCodeAt (index) returns the Unicode encoding of the character at index of the string, which is an integer between 0~65535, or Nan If index is out of range.

Concat (STR2) joins the string str2 the current string to form a new string.

Anchor (ANCHAR_NAME) Create an anchor point

Link (URL) plus hyperlink

CharAt (index) returns a character at the specified position of the index in the string

JavaScript---string and arry

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.