js String方法集合
生活随笔
收集整理的這篇文章主要介紹了
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();
//返回對應索引的字符 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
總結
以上是生活随笔為你收集整理的js String方法集合的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 转-iOS开发系列--地图与定位
- 下一篇: 读取一个文件中的字符,统计每个字符出现的