The string function of JavaScript

Source: Internet
Author: User

(1) anchor function: Generates a link point (anchor) for use as a hyperlink. The Anchor function sets the name of the <ANAME...> link, and the other function link sets the URL address of the <a href=...>.

(2) Big function: Add the font to a number, the same as the <BIG>...</BIG> label result.

(3) Blink function: Causes the string to blink, the same as the <BLINK>...</BLINK> label result.

(4) bold function: Makes the font bold, the same as the <B>...</B> label result.

(5) charAt function: Returns a character specified in the string.

(6) Fixed function: Sets the font to a fixed-width font, the same as the <TT>...</TT> label result.

(7) fontcolor function: Sets the font color, the same as the <FONTCOLOR=color> label result.

(8) fontsize function: Sets the font size to be the same as the <FONTSIZE=n> label result.

(9) indexOf function: Returns the index of the first lookup in a string, starting from the left.

(10) italics function: Makes the font italic, the same as the <I>...</I> label result.

(11) lastIndexOf function: Returns the index of the first lookup in a string, starting from the right.

(12) Length function: Returns the lengths of the strings. (without parentheses)

(13) link function: Generates a hyperlink equivalent to the URL address of the set <AHREF=...>.

(14) Small function: decrease the font size by one number and the same as the <SMALL>...</SMALL> label result.

(15) Strike Function: Add a horizontal line to the middle of the text, the same as the <STRIKE>...</STRIKE> label result.

(16) Sub function: Displays the string as subscript (subscript).

(17) substring function: Returns the number of characters specified in the string.

(18) sup Function: The display string is the superscript word (superscript).

(19) tolowercase Function: Converts a string to lowercase.

(20) touppercase Function: Converts a string to uppercase.

(21) The match function, which searches the string with a regular expression, returns an array containing the search results

var str = "helloworld!"; Document.writeln (Str.match ("World"));d Ocument.writeln (Str.match ("World"));

Results:

World

Null

(22) the search function, which searches the string with a regular expression, returns the position of the first matched string within the entire searched string

var str = "helloworld!"; Document.writeln (Str.search (/world/));

Results:

6

(23) Replace (regexp/substr,replacement) function that replaces the matched substring with the specified string, returning a new string

(24) Split ([Separator][,limit]) function that splits a string by a specified delimiter, which can be added to the length limit, returning the segmented substring array


The string function of JavaScript

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.