JavaScript common string methods and properties

Source: Internet
Author: User
Tags string methods

I've been listening to you on Himalaya. (JavaScript Web front-end) host Shahi

It's a good one. Buy this book now make a note

var str = ' ABCD '

Str.charat (0); Output the character of the subscript position

Str.charcodeat (0);//The character encoding value of the output subscript position

Str.concat (' e '); Output stitched string

Str.indexof (' C '); Outputs the subscript position of the specified character

Str.lastindexof (' C '); From backward forward search output the subscript position of the specified character

Str.length; Output string length

Str.localecompare (' EFG '); According to the rules of alphabetical order comparison, output comparison results, front output 1, back output-1, equal output 0

Str.search (' a '); Outputs the subscript position of the specified character

Str.slice (1,5); Outputs a character that specifies the start subscript to the end of the subscript, but does not include the end position

Str.split (' C '); The output string is split into arrays with the specified characters

Str.substr (0,2); Outputs a character that specifies the length behind the subscript

Str.substring (0); If no end position subscript is specified, the output specifies the character to start subscript to the last subscript

Str.substring (0,3); The output specifies the character that starts subscript to the end of the subscript, but does not include the ending position. If the parameter is negative, the auto-convert parameter is 0. If the second parameter is less than the first parameter, the position of the parameter is automatically swapped

Str.tolowercase (); Output characters that are converted to lowercase letters

Str.tostring (); Data that outputs other types of data as String types

Str.touppercase (); Output converted to uppercase characters

String.fromCharCode (10000); Convert Unicode encoding to corresponding text

JavaScript common string methods and properties

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.