1.charAt()
Find Returns the position of character
var STR = "ABCDEFG" ; var S = str.charAt (5); // subscript character 5 of the console.log (S); // F
2.charcodeAt()
Find Returns the position of a character code unicdoe
var STR = "ABCDEFG" ; var S = str.charCodeAt (5); // subscript character code 5 unicdoe the console.log (S); // 102
3.concat()
Connection String
var str = "abc"; var str1 = str.concat("a", "b", "c", "dsdafsdafsad"); console.log(str1);//abcabcdsdafsdafsad
4.slice()
String interception
var str = "abcdefghijklm"; var str1 = str.slice(1, 5); console.log(str1);//bcde
Please refer to detailed usage array usage.
5.split()
String into an array
var str = "abcdefg" var str1 =str.split("") console.log(str);//abcdefg console.log(str1)//["a", "b", "c", "d", "e", "f", "g"]
6.substring()
String interception
var STR = "ABCDEFGHIJKLM" ; var str1 str.substring = (1, 9); // start from a lower end to the lower side 9 9 that does not include a subscript var str2 str.substring = (9, 1 ); Console .log (str1); // bcdefghi console.log (str2); // bcdefghi
7.substr()
String interception
var STR = "ABCDEFGHIJKLM" ; var str1 = str.substr (2, 6); // index number 2 from the start number 6 back the console.log (str1); // cdefgh
8.indexOf()
Traversal strings
The search string contains a first parameter, such as return comprising a first subscript, stop searching, or -1 if not. The second parameter indicates the index from the beginning to find.
var str = "abcdefabcjklm"; var a = str.indexOf("abc") var b = str.indexOf("abc", 1); console.log(a);//0 console.log(b);//6
9.toUpperCase
Turn uppercase
var str = "aAbBcCdD"; console.log(str.toUpperCase());//AABBCCDD
10.toLowerCase
Small letter
var str = "aAbBcCdD"; console.log(str.toLowerCase());//aabbccdd
11.replace()
Replacement string
Only one match
var str = "a good weather day today" ; var str1 = str.replace ( "every day", "**" ); console.log (str1); // this good weather days **
12.match()
Find string
var str = "The weather today is good" ; var the Result = str.match ( "every day" ); console.log (the Result); // [ "every day", index: 1, input: " Today the weather is good", groups: undefined ]
13.search()
Find the returned string subscript
var str = "The weather today is a good day" ; var the Result = str.search ( "every day" ); console.log (the Result); // 1