string.substring(indexA, indexB) Returns: String of characters between index values indexA and indexB.The string.substring() method enables your scripts to extract a copy of a contiguous range of characters from any string. The parameters to this method are the starting and ending index values (first character of the string object is index value 0) of the main string from which the excerpt should be taken. An important item to note is that the excerpt goes up to, but does not include, the character pointed to by the higher index value. It makes no difference which index value in the parameters is larger than the other: The method starts the excerpt from the lowest value and continues to (but does not include) the highest value. If both index values are the same, the method returns an empty string; and if you omit the second parameter, the end of the string is assumed to be the endpoint.例: var aStr = "this is a book"; var bStr = aStr.substring(0, 4);bStr的值为"this"
的很象.所以我们学JAVA的学javascript还是比较简单的
Returns: String of characters between index values indexA and indexB.The string.substring() method enables your scripts to extract a copy of a
contiguous range of characters from any string. The parameters to this method are
the starting and ending index values (first character of the string object is index
value 0) of the main string from which the excerpt should be taken. An important
item to note is that the excerpt goes up to, but does not include, the character
pointed to by the higher index value.
It makes no difference which index value in the parameters is larger than the
other: The method starts the excerpt from the lowest value and continues to (but
does not include) the highest value. If both index values are the same, the method
returns an empty string; and if you omit the second parameter, the end of the
string is assumed to be the endpoint.例:
var aStr = "this is a book";
var bStr = aStr.substring(0, 4);bStr的值为"this"