ICSE Class 10 Computer Applications
Question 10 of 46
String Handling — Question 10
Back to all questions 10
Question Question 2(ix)
Mention the purpose and syntax of substring() method.
The substring() method returns a new string that is a substring of the given string. It has two variations:
Syntax:stringObject.substring(int startindex)
The above method returns a substring beginning from the startindex and extending to the end of the string.
Syntax:stringObject.substring(int startIndex, int endIndex)
The above method returns a substring beginning from the startindex and extending to the character at index endIndex - 1.