stringObject.substr(start,length)
<script type="text/javascript"> var str="Hello world!" document.write(str.substr(3)) </script>输出:
lo world!<script type="text/javascript"> var str="Hello world!" document.write(str.substr(3,7)) </script>输出:
lo worl
注意:
window.location.search.substr(1);这个是截取第一个 以后的包括下标是1的那个字符直到最后!
本文介绍JavaScript中使用substr方法截取字符串的方法,通过示例展示了如何指定开始位置和长度来获取子串。
117

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



