js String方法集合

//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
//
返回对应索引的字符 chartAt() //返回对应所引的字符的统一码(Unicode value) charCodeAt() //Returns a non-negative integer that is the UTF-16 encoded code point value at the given position. codePointAt(); //拼接两个字符串,并返回一个新的字符串 concat(); //Determines whether one string may be found within another string. includes(); //Determines whether a string ends with the characters of another string. endsWidth(); //返回一个字符串在另一个字符串中首次出现的位置,如果查找不到,返回-1 indexOf(); //返回一个字符串在另一个字符串中末次出现的位置,如果查找不到,返回-1 lastIndexOf(); //Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order. localeCompare(); //用字符串匹配一个字符串 mach(); //Returns the Unicode Normalization Form of the calling string value. normalize(); //Returns a string consisting of the elements of the object repeated the given times. repeat(); //找出字符串中和正则表达式匹配的部分,并用一个新的子串替换 replace(); //找出字符串中和正则表达式匹配的部分 search(); //截取字符串的一部分返回 slice(); //把一个字符串分割成数组,分割点为传入的子串 split(); //Returns the characters in a string beginning at the specified location through the specified number of characters. substr(); // substring(); // toLocalLowerCase(); // toLocalUpperCase(); toLowerCase(); toSource(); toString(); toUpperCase(); trim(); valueOf();
原文地址:https://www.cnblogs.com/flyfly/p/4776405.html