arcgis jscript参考http://technet.microsoft.com/zh-cn/library/997bcd30(v=vs.80)
返回一个从指定位置开始,并具有指定长度的子字符串。
function substr(start : Number [, length : Number]) : String
- start
-
必选。所需的子字符串的起始位置。字符串中第一个字符的索引为 0。
- length
-
可选项。返回的子字符串中包含的字符数。
如果 length 为 0 或负数,将返回一个空字符串。如果没有指定该参数,则子字符串将延续到字符串的结尾。
下面的示例阐释了 substr 方法的用法。
function SubstrDemo(){
var s, ss; //Declare variables.
var s = "The rain in Spain falls mainly in the plain.";
ss = s.substr(12, 5); //Get substring.
return(ss); // Returns "Spain".
}