String splicing :
concat() : String splicing
let num = "1"; let num1 = num.concat("2") console.log(num1) //"12"String delete : Create a copy of the original string , Then delete the copy
slice(): Two parameters . The first is the starting position , The second is the end position
substr(): Two parameters . The first is the starting position , The second is the total number of elements
substring(): Two parameters . The first is the starting position , The second is the end position
let stringValue = "hello world"; console.log(stringValue.slice(3)); // "lo world" console.log(stringValue.substring(3)); // "lo world" console.log(stringValue.substr(3)); // "lo world" console.log(stringValue.slice(3, 7)); // "lo w" console.log(stringValue.substring(3,7)); // "lo w" console.log(stringValue.substr(3, 7)); // "lo worl"
Modify string : Create a copy of the original string , Then modify the copy
trim() : Remove all spaces before and after , And return the new string
trimLeft() : Delete all preceding spaces , And return the new string
trimRight() : Delete all the following spaces , And return the new string
let str = " hello " let str1 = str.trim(); console.log(str) // " hello " console.log(str1) //"hello"
repeat(n) : Copy n Substring , Then all the results are spliced and returned
let str = "name"; let str1 = str.repeat(2) //name name
padStart(n): Copy string , If it is less than n, The character... Is added before the string
let str = "name"; let str1 = str.padStart(6, ".") // "..name"
padEnd(n): Copy string , If it is less than n, Then the character... Is added after the string
let str = "name"; let str1 = str.padStart(6, ".") // "name.."
toLowerCase() : Convert a string to lowercase
let str = "ABC"; let str1 = str.toLowerCase(); //"abc"
toUpperCase() : Convert a string to uppercase
let str = "abc"; let str1 = str.toLowerCase(); //"ABC"
To find the character
chatAt(n) : return n Characters in position
let str = "abcde"; let str1 = str.charAt(2); // "c"
indexOf() : Find the incoming string from the beginning , Return to the first Find the position of this string ( No return found -1)
let str = "abcde"; let str1 = str.charAt("b"); // 1startWith() 、includes() : Find the incoming string from the string , If any, return true, Otherwise return to false
let str = "abcdefg" let str1 = str.startWith("abcd") //true let str2 = str.includes("abcd") //trueString to array :split() : Split the string into an array according to the specified delimiter
let str = "abcd";
let str1 = str.split("") //[a, b, c, d]

![全排列II[存在相同元素去重 + 标准回溯]](/img/d3/93ddb49e580be60be4f056f141b782.png)





