The substring method belongs to the String object. This method enables the programmers to extract a contiguous range of characters from a string. There are two parameters; start and end, passed in this method. The characters are displayed in the range of numbers between the start and end. The position of the first character is zero. If the value of end is not provided, the end of the string is considered as the endpoint.
The syntax of the substring method is as follows:
The following code will demonstrate the use of the substring method:
var str2=str1.substring(2,5)
trace(str2) //output: str
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.