js对字符串的操作

时间:2021-06-16 17:34:15   收藏:0   阅读:0

1、charCodeAt(index);  

返回一个整数,代表下标位置上字符的Unicode的编码。

2.fromCharCode(code1,code2,code3,...);

code1代表Unicode编码数

3、charAt(index);

返回指定下标的字符,超出返回一个空字符。

4.slice(start,end);

注:end下标不包括自己本身

下标start、end可以为负数,如果为为负数,则作为length+start/end处理。

5、substring(start,end);

6、substr(index,length);

7、indexOf(str,strIndex);

8、lastIndexOf(str,strIndex);

9、search(reExp);

10、concat(str,str1,...);

11、toUpperCase();

12、split(separator,limit);

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!