JS String Object method

Source: Internet
Author: User

CharAt Returns the character Str.charat (index) at the specified index; charcodeat returns an Integer that represents the Unicode encoding of the character at the specified position. Str.charcodeat (Index) concat returns a string value that contains the connection of two or more supplied strings. Str.concat (STR1,STR2); fromCharCode returns a string from some Unicode character values. String.fromCharCode ( -,101,102);//defIndexOf returns the character position of the substring within the string object for the first time. Str.indexof ('Test'LastIndexOf Returns the position of the last occurrence of a substring of a string object. Str.lastindexof ('Test'Match uses the regular expression pattern to perform a lookup on a string and returns the result that contains the lookup as an array.             Str.match (RGEXP); varR, re;//declares a variable.            vars ="The rain in Spain falls mainly in the plain"; Re=/ain/i;//creates a regular expression pattern. R =S.match (re); Replace returns the copy of the string after the literal substitution based on the regular expression. Str.replace ('T','a'); If you do not use regular expressions, you can replace only one, using regular expressions to replace allvarR, re;//declares a variable.             varSS ="The man hits the ball with the bat.\n"; SS+="While the fielder caught the ball with the glove."; Re=/the/g;//creates a regular expression pattern. r = Ss.replace (Re,"A");//Replace "A" with "A". search returns the position of the first substring that matches the regular expression find content. Str.search ('T'); varR, re;//declares a variable.         vars ="The rain in Spain falls mainly in the plain."; Re=/falls/i;//creates a regular expression pattern. r = S.search (re);//finds a string. Slice returns a fragment of a string. Str.slice (start,end); split divides a string into substrings, and then returns the result as an array of strings. Str.split ('=='); varS, SS; vars ="The rain in Spain falls mainly in the plain."; //decompose at each space character. SS = S.split (" ") substr Returns a substring of the specified length starting at the specified position. Str.substr (start [, length]) str.substr (5, A); Starting from 5 length 12substring returns the substring at the specified position in the string object.  Str.substring (start, end); toLowerCase returns a string in which the letters in the string are converted to lowercase letters. Str.tolowercase () toUpperCase returns a string in which all letters in the string are converted to uppercase letters. Str.touppercase () toString returns the string representation of the object. Obj.tostring ([radix]) radix options available.        Specifies the binary when converting a numeric value to a string. 

JS String Object method

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.