Operation of the string:
Length: str.length;
Subscript: str[1];
Returns the character of a position: Str.charat (); Where to look in parentheses.
return character encoding: Str.charcodeat (); Where to look in parentheses.
return character: String.formcharcode (,); There are multiple write codes in parentheses
Returns a character position (left → right): str.indexof (); Write a character in parentheses not found return-1
(' AA ', 5)//start looking for AA from 5th position, negative for second parameter, as 0
Returns a character position (right → left): str.lastindexof ();
Intercept string: str.substring (); (0,5) from 0 to 5; (5,0) from 0 to 5; ( -2,5) from 0 to 5
: Str.slice (); (0,5) from 0 to 5; (5,0) not found; ( -2,5) second-to-last
Split string: Str.split (); (‘.‘) Take. To divide, return an array; the second parameter is length
Convert to uppercase: Str.touppercase ();
Convert to lowercase: str.tolowercase ();
Definition: var arr = [n/a]; var arr = new Array (No.);
Array Length: arr.length//readable writable
Added value: Arr.push (); Added later, returns the array length
Arr.unshift (); Previous add, return array length
Deleted: Arr.pop (); Delete the last one of the arrays, return the one that was deleted
Arr.shift (); Delete the first of the array, return the deleted
Splice:arr.splice (); (0,1); Delete 1 from the No. 0 bit and return the deleted one
(0,1, ' a '); Replace the first bit of the beginning of the No. 0 bit with ' a ',
(0,0, ' a '); Add ' A ' after the No. 0 bit
Sort: Arr.sort (); Sort by character encoding
function parameters
Reverse can be used reverse
Two array splicing: Concat (); Arr1.concat (ARR2)
Changed to String: Jion (); Arr.jion (' a ') to string A as a boundary character
JAVASCRITPT string manipulation