JavaScript Daily Learning 5

Source: Internet
Author: User

Javascriptstring properties and Methods

Eg:var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var sln = txt.length;

String properties
Properties Description
Constructor Returns a function that creates a string property
Length Returns the length of a string
Prototype Allows you to add properties and methods to an object
String method
Method Description
CharAt () Returns the character of the specified index position
charCodeAt () Returns the Unicode value of the specified index position character
Concat () Concatenate two or more strings, returning the concatenated string
fromCharCode () Convert Unicode to a string
IndexOf () Retrieves the position of the first occurrence of the specified character in a string
LastIndexOf () Retrieves the position of the last occurrence of the specified character in a string
Localecompare () Compare two strings in a local-specific order
Match () Found a match for one or more regular expressions
Replace () To replace a substring that matches a regular expression
Search () Retrieving a value that matches a regular expression
Slice () Extracts a fragment of a string and returns the extracted part in a new string
Split () To split a string into a substring array
SUBSTR () Extracts a specified number of characters from the starting index number in a string
SUBSTRING () Extracts the characters between two specified index numbers in a string
toLocaleLowerCase () Converts a string to lowercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mapping
toLocaleUpperCase () Converts a string to uppercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mapping
toLowerCase () Convert a string to lowercase
ToString () Returns the String object value
toUpperCase () Convert a string to uppercase
Trim () Remove string end and end blanks
ValueOf () Returns the original value of a string object

JavaScript Daily Learning 5

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.