http://www.w3cschool.cc/jsref/jsref-obj-string.html
String 对象方法
| 方法 | 描述 |
|---|---|
| charAt() | 返回在指定位置的字符。 |
| charCodeAt() | 返回在指定的位置的字符的 Unicode 编码。 |
| concat() | 连接两个或更多字符串,并返回新的字符串。 |
| fromCharCode() | 将 Unicode 编码转为字符。 |
| indexOf() | 返回某个指定的字符串值在字符串中首次出现的位置。 |
| lastIndexOf() | 从后向前搜索字符串。 |
| match() | 查找找到一个或多个正则表达式的匹配。 |
| replace() | 在字符串中查找匹配的子串, 并替换与正则表达式匹配的子串。 |
| search() | 查找与正则表达式相匹配的值。 |
| slice() | 提取字符串的片断,并在新的字符串中返回被提取的部分。 |
| split() | Splits a string into an array of substrings |
| substr() | 从起始索引号提取字符串中指定数目的字符。 |
| substring() | 提取字符串中两个指定的索引号之间的字符。 |
| toLowerCase() | Converts a string to lowercase letters |
| toUpperCase() | 把字符串转换为大写。 |
| trim() | Removes whitespace from both ends of a string 如:str.trim();str.trim().length;
JavaScript中valueOf函数方法是返回指定对象的原始值。 |
JavaScript String 方法总结
本文介绍了JavaScript中String对象的各种方法,包括charAt(), charCodeAt(), concat(), fromCharCode(), indexOf(), lastIndexOf(), match(), replace(), search(), slice(), split(), substr(), substring(), toLowerCase(), toUpperCase(), trim()等,以及解释了如何使用这些方法进行字符串操作。
599

被折叠的 条评论
为什么被折叠?



