JS 中的substring ,substr ,slice,split,join
Posted 加勒比海豹丶
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JS 中的substring ,substr ,slice,split,join相关的知识,希望对你有一定的参考价值。
- substr with different arguments passed in:
- str.substring(startNum,stopNum );
- str.slice(startNum,stopNum );
- str.substr(startNum,length );
- substring vs slice
- start = stop ,return ‘ ‘; the same.
- start or stop bigger than str.length, it will make the bigger one equal str.length.
- start < 0 || stop < 0, substring will make it equal 0, but slice won’t do like this.
- start > stop ,substring will swap those two arguments, but slice won’t do like this.
- str.split(‘&‘,num ) < == == > array.join(‘&’);
以上是关于JS 中的substring ,substr ,slice,split,join的主要内容,如果未能解决你的问题,请参考以下文章