Index and length must refer to a location within the string是什么错?

来源:互联网 发布:php 2年工作经验 编辑:程序博客网 时间:2024/06/06 04:43
这个是我在使用,string.substring时出现的,这个错误有两个方面,一个是index越限,另一个是length越限。比如:strComm.substring(strComm.length-2,strComm.length);这里面就是length越界了,这个是因为我对sunstring不熟悉,他的第二个参数,表示的是你要的自串的长度。 
原创粉丝点击